Package org.jcsp.net.dynamic
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 NetChannelOutput
The actual networked output channel end.private FilteredChannelOutput
The filtered channel end.private Vector
The filters applied to the channel.private OutputReconnectionManager
The output reconnection manager for the channel. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a newMigratableChannelOutputImpl
with the given reconnection manager.MigratableChannelOutputImpl
objects constructed with this constructor make use of the default channel name service. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addWriteFilter
(Filter filter) Installs a write filter defining a transformation to be applied by thewrite
method of the channel end.void
addWriteFilter
(Filter filter, int index) Installs a write filter defining a transformation to be applied by thewrite
method of the channel end at a specific index.void
Destroys the channel writer end and frees all the underlying JCSP.NET resources.Returns the location of theNetworked
ChannelInput
.Returns the factory class used for constructing this channel end object.getWriteFilter
(int index) Returns the write filter installed at the given index.int
Returns the number of write filters currently installed.void
poison
(int strength) Currently, network channels are unpoisonable so this method has no effect.void
Prepares the channel end for movement to another node.void
recreate()
Requests that the instance of the implementing class should reinitialize itself.void
recreate
(NetChannelLocation newLoc) Requests that the instance of the implementing class should reinitialize itself with a new location.void
removeWriteFilter
(int index) Removes the write filter installed at the given index.void
removeWriteFilter
(Filter filter) Removes the first write filter (lowest index) matching the filter given as a parameter.void
Write 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
MigratableChannelOutputImpl
objects constructed with this constructor make use of the default channel name service.- Parameters:
out
- the underlying networked channel output.
-
MigratableChannelOutputImpl
Constructs a newMigratableChannelOutputImpl
with the given reconnection manager.- Parameters:
mgr
- the reconnection manager to use for the channel.
-
-
Method Details
-
prepareToMove
public void prepareToMove()Description copied from interface:MigratableChannelOutput
Prepares the channel end for movement to another node.- Specified by:
prepareToMove
in interfaceMigratableChannelOutput
- See Also:
-
recreate
public void recreate()Description copied from interface:NetChannelOutput
Requests that the instance of the implementing class should reinitialize itself.
- Specified by:
recreate
in interfaceNetChannelOutput
- See Also:
-
recreate
Description copied from interface:NetChannelOutput
Requests that the instance of the implementing class should reinitialize itself with a new location.
- Specified by:
recreate
in interfaceNetChannelOutput
- Parameters:
newLoc
- the new location.- See Also:
-
destroyWriter
public void destroyWriter()Description copied from interface:NetChannelOutput
Destroys the channel writer end and frees all the underlying JCSP.NET resources.
- Specified by:
destroyWriter
in interfaceNetChannelOutput
- See Also:
-
write
Description copied from interface:ChannelOutput
Write an Object to the channel.- Specified by:
write
in interfaceChannelOutput
- Parameters:
object
- the object to write to the channel- See Also:
-
getChannelLocation
Description copied from interface:Networked
Returns the location of theNetworked
ChannelInput
.- Specified by:
getChannelLocation
in interfaceNetworked
- Returns:
- the
NetChannelLocation
object. - See Also:
-
getFactoryClass
Description copied from interface:NetChannelOutput
Returns the factory class used for constructing this channel end object.
- Specified by:
getFactoryClass
in interfaceNetChannelOutput
- Returns:
- the
Class
of the
-
addWriteFilter
Description copied from interface:WriteFiltered
Installs a write filter defining a transformation to be applied by thewrite
method 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:
addWriteFilter
in interfaceWriteFiltered
- Parameters:
filter
- the filter to be installed; may not be null.- See Also:
-
addWriteFilter
Description copied from interface:WriteFiltered
Installs a write filter defining a transformation to be applied by thewrite
method 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:
addWriteFilter
in 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:WriteFiltered
Removes 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:
removeWriteFilter
in interfaceWriteFiltered
- Parameters:
filter
- the filter to be removed; may not be null.- See Also:
-
removeWriteFilter
public void removeWriteFilter(int index) Description copied from interface:WriteFiltered
Removes the write filter installed at the given index. The remaining filters are shifted to close the gap in the index allocation.- Specified by:
removeWriteFilter
in interfaceWriteFiltered
- Parameters:
index
- zero-based index of the filter to be removed.- See Also:
-
getWriteFilter
Description copied from interface:WriteFiltered
Returns the write filter installed at the given index.- Specified by:
getWriteFilter
in 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:WriteFiltered
Returns the number of write filters currently installed.- Specified by:
getWriteFilterCount
in 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:
poison
in interfacePoisonable
- Parameters:
strength
- the strength of the poison (must be >= 0).
-