Package org.jcsp.net.dynamic
Class MigratableChannelOutputImpl
- java.lang.Object
-
- org.jcsp.net.dynamic.MigratableChannelOutputImpl
-
- All Implemented Interfaces:
java.io.Serializable
,ChannelOutput
,Poisonable
,MigratableChannelOutput
,NetChannelOutput
,Networked
,FilteredChannelOutput
,WriteFiltered
class MigratableChannelOutputImpl extends java.lang.Object implements MigratableChannelOutput
Implements of a migratable networked channel output end.
-
-
Field Summary
Fields Modifier and Type Field Description private NetChannelOutput
actualOut
The actual networked output channel end.private FilteredChannelOutput
filteredOut
The filtered channel end.private java.util.Vector
filters
The filters applied to the channel.private OutputReconnectionManager
mgr
The output reconnection manager for the channel.
-
Constructor Summary
Constructors Constructor Description MigratableChannelOutputImpl(OutputReconnectionManager mgr)
Constructs a newMigratableChannelOutputImpl
with the given reconnection manager.MigratableChannelOutputImpl(NetChannelOutput out)
MigratableChannelOutputImpl
objects constructed with this constructor make use of the default channel name service.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
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
destroyWriter()
Destroys the channel writer end and frees all the underlying JCSP.NET resources.NetChannelLocation
getChannelLocation()
Returns the location of theNetworked
ChannelInput
.java.lang.Class
getFactoryClass()
Returns the factory class used for constructing this channel end object.Filter
getWriteFilter(int index)
Returns the write filter installed at the given index.int
getWriteFilterCount()
Returns the number of write filters currently installed.void
poison(int strength)
Currently, network channels are unpoisonable so this method has no effect.void
prepareToMove()
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(java.lang.Object object)
Write an Object to the channel.private void
writeObject(java.io.ObjectOutputStream out)
-
-
-
Field Detail
-
mgr
private OutputReconnectionManager mgr
The output reconnection manager for the channel.
-
actualOut
private transient NetChannelOutput actualOut
The actual networked output channel end.
-
filteredOut
private transient FilteredChannelOutput filteredOut
The filtered channel end.
-
filters
private java.util.Vector filters
The filters applied to the channel.
-
-
Constructor Detail
-
MigratableChannelOutputImpl
public MigratableChannelOutputImpl(NetChannelOutput out)
MigratableChannelOutputImpl
objects constructed with this constructor make use of the default channel name service.- Parameters:
out
- the underlying networked channel output.
-
MigratableChannelOutputImpl
public MigratableChannelOutputImpl(OutputReconnectionManager mgr)
Constructs a newMigratableChannelOutputImpl
with the given reconnection manager.- Parameters:
mgr
- the reconnection manager to use for the channel.
-
-
Method Detail
-
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:
MigratableChannelOutput.prepareToMove()
-
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:
NetChannelOutput.recreate()
-
recreate
public void recreate(NetChannelLocation newLoc)
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:
NetChannelOutput.recreate(NetChannelLocation)
-
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:
NetChannelOutput.destroyWriter()
-
write
public void write(java.lang.Object object)
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:
ChannelOutput.write(Object)
-
getChannelLocation
public NetChannelLocation getChannelLocation()
Description copied from interface:Networked
Returns the location of theNetworked
ChannelInput
.- Specified by:
getChannelLocation
in interfaceNetworked
- Returns:
- the
NetChannelLocation
object. - See Also:
Networked.getChannelLocation()
-
getFactoryClass
public java.lang.Class 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
public void addWriteFilter(Filter filter)
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:
WriteFiltered.addWriteFilter(Filter)
-
addWriteFilter
public void addWriteFilter(Filter filter, int index)
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:
WriteFiltered.addWriteFilter(Filter, int)
-
removeWriteFilter
public void removeWriteFilter(Filter filter)
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:
WriteFiltered.removeWriteFilter(Filter)
-
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:
WriteFiltered.removeWriteFilter(int)
-
getWriteFilter
public Filter getWriteFilter(int index)
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:
WriteFiltered.getWriteFilter(int)
-
getWriteFilterCount
public int getWriteFilterCount()
Description copied from interface:WriteFiltered
Returns the number of write filters currently installed.- Specified by:
getWriteFilterCount
in interfaceWriteFiltered
- See Also:
WriteFiltered.getWriteFilterCount()
-
writeObject
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException
- Throws:
java.io.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).
-
-