Class MigratableChannelOutputImpl
java.lang.Object
org.jcsp.net.dynamic.MigratableChannelOutputImpl
- All Implemented Interfaces:
Serializable, ChannelOutput, Poisonable, MigratableChannelOutput, NetChannelOutput, Networked, FilteredChannelOutput, WriteFiltered
Implements of a migratable networked channel output end.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate NetChannelOutputThe actual networked output channel end.private FilteredChannelOutputThe filtered channel end.private VectorThe filters applied to the channel.private OutputReconnectionManagerThe output reconnection manager for the channel. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a newMigratableChannelOutputImplwith the given reconnection manager.MigratableChannelOutputImplobjects constructed with this constructor make use of the default channel name service. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddWriteFilter(Filter filter) Installs a write filter defining a transformation to be applied by thewritemethod of the channel end.voidaddWriteFilter(Filter filter, int index) Installs a write filter defining a transformation to be applied by thewritemethod of the channel end at a specific index.voidDestroys the channel writer end and frees all the underlying JCSP.NET resources.Returns the location of theNetworkedChannelInput.Returns the factory class used for constructing this channel end object.getWriteFilter(int index) Returns the write filter installed at the given index.intReturns the number of write filters currently installed.voidpoison(int strength) Currently, network channels are unpoisonable so this method has no effect.voidPrepares the channel end for movement to another node.voidrecreate()Requests that the instance of the implementing class should reinitialize itself.voidrecreate(NetChannelLocation newLoc) Requests that the instance of the implementing class should reinitialize itself with a new location.voidremoveWriteFilter(int index) Removes the write filter installed at the given index.voidremoveWriteFilter(Filter filter) Removes the first write filter (lowest index) matching the filter given as a parameter.voidWrite an Object to the channel.private void
-
Field Details
-
mgr
The output reconnection manager for the channel. -
actualOut
The actual networked output channel end. -
filteredOut
The filtered channel end. -
filters
The filters applied to the channel.
-
-
Constructor Details
-
MigratableChannelOutputImpl
MigratableChannelOutputImplobjects constructed with this constructor make use of the default channel name service.- Parameters:
out- the underlying networked channel output.
-
MigratableChannelOutputImpl
Constructs a newMigratableChannelOutputImplwith the given reconnection manager.- Parameters:
mgr- the reconnection manager to use for the channel.
-
-
Method Details
-
prepareToMove
public void prepareToMove()Description copied from interface:MigratableChannelOutputPrepares the channel end for movement to another node.- Specified by:
prepareToMovein interfaceMigratableChannelOutput- See Also:
-
recreate
public void recreate()Description copied from interface:NetChannelOutputRequests that the instance of the implementing class should reinitialize itself.
- Specified by:
recreatein interfaceNetChannelOutput- See Also:
-
recreate
Description copied from interface:NetChannelOutputRequests that the instance of the implementing class should reinitialize itself with a new location.
- Specified by:
recreatein interfaceNetChannelOutput- Parameters:
newLoc- the new location.- See Also:
-
destroyWriter
public void destroyWriter()Description copied from interface:NetChannelOutputDestroys the channel writer end and frees all the underlying JCSP.NET resources.
- Specified by:
destroyWriterin interfaceNetChannelOutput- See Also:
-
write
Description copied from interface:ChannelOutputWrite an Object to the channel.- Specified by:
writein interfaceChannelOutput- Parameters:
object- the object to write to the channel- See Also:
-
getChannelLocation
Description copied from interface:NetworkedReturns the location of theNetworkedChannelInput.- Specified by:
getChannelLocationin interfaceNetworked- Returns:
- the
NetChannelLocationobject. - See Also:
-
getFactoryClass
Description copied from interface:NetChannelOutputReturns the factory class used for constructing this channel end object.
- Specified by:
getFactoryClassin interfaceNetChannelOutput- Returns:
- the
Classof the
-
addWriteFilter
Description copied from interface:WriteFilteredInstalls a write filter defining a transformation to be applied by thewritemethod of the channel end. The filter will be appended to the end of the current list, making it the last to be applied.- Specified by:
addWriteFilterin interfaceWriteFiltered- Parameters:
filter- the filter to be installed; may not be null.- See Also:
-
addWriteFilter
Description copied from interface:WriteFilteredInstalls a write filter defining a transformation to be applied by thewritemethod of the channel end at a specific index. If there is already a filter at that index position the existing filters are shifted to make room. If the index is greater than the number of filters already installed the filter is placed at the end.- Specified by:
addWriteFilterin interfaceWriteFiltered- Parameters:
filter- the filter to be installed; may not be null.index- the zero based index; may not be negative.- See Also:
-
removeWriteFilter
Description copied from interface:WriteFilteredRemoves the first write filter (lowest index) matching the filter given as a parameter. The filter removed,r, will satisfy the conditionr.equals (filter). The remaining filters are shifted to close the gap in the index allocation.- Specified by:
removeWriteFilterin interfaceWriteFiltered- Parameters:
filter- the filter to be removed; may not be null.- See Also:
-
removeWriteFilter
public void removeWriteFilter(int index) Description copied from interface:WriteFilteredRemoves the write filter installed at the given index. The remaining filters are shifted to close the gap in the index allocation.- Specified by:
removeWriteFilterin interfaceWriteFiltered- Parameters:
index- zero-based index of the filter to be removed.- See Also:
-
getWriteFilter
Description copied from interface:WriteFilteredReturns the write filter installed at the given index.- Specified by:
getWriteFilterin interfaceWriteFiltered- Parameters:
index- zero-based index of the filter to return.- Returns:
- the filter at that position.
- See Also:
-
getWriteFilterCount
public int getWriteFilterCount()Description copied from interface:WriteFilteredReturns the number of write filters currently installed.- Specified by:
getWriteFilterCountin interfaceWriteFiltered- See Also:
-
writeObject
- Throws:
IOException
-
poison
public void poison(int strength) Currently, network channels are unpoisonable so this method has no effect.- Specified by:
poisonin interfacePoisonable- Parameters:
strength- the strength of the poison (must be >= 0).
-