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 NetChannelOutputactualOutThe actual networked output channel end.private FilteredChannelOutputfilteredOutThe filtered channel end.private java.util.VectorfiltersThe filters applied to the channel.private OutputReconnectionManagermgrThe output reconnection manager for the channel.
-
Constructor Summary
Constructors Constructor Description MigratableChannelOutputImpl(OutputReconnectionManager mgr)Constructs a newMigratableChannelOutputImplwith the given reconnection manager.MigratableChannelOutputImpl(NetChannelOutput out)MigratableChannelOutputImplobjects 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 voidaddWriteFilter(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.voiddestroyWriter()Destroys the channel writer end and frees all the underlying JCSP.NET resources.NetChannelLocationgetChannelLocation()Returns the location of theNetworkedChannelInput.java.lang.ClassgetFactoryClass()Returns the factory class used for constructing this channel end object.FiltergetWriteFilter(int index)Returns the write filter installed at the given index.intgetWriteFilterCount()Returns the number of write filters currently installed.voidpoison(int strength)Currently, network channels are unpoisonable so this method has no effect.voidprepareToMove()Prepares 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(java.lang.Object object)Write an Object to the channel.private voidwriteObject(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)
MigratableChannelOutputImplobjects 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 newMigratableChannelOutputImplwith the given reconnection manager.- Parameters:
mgr- the reconnection manager to use for the channel.
-
-
Method Detail
-
prepareToMove
public void prepareToMove()
Description copied from interface:MigratableChannelOutputPrepares the channel end for movement to another node.- Specified by:
prepareToMovein interfaceMigratableChannelOutput- See Also:
MigratableChannelOutput.prepareToMove()
-
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:
NetChannelOutput.recreate()
-
recreate
public void recreate(NetChannelLocation newLoc)
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:
NetChannelOutput.recreate(NetChannelLocation)
-
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:
NetChannelOutput.destroyWriter()
-
write
public void write(java.lang.Object object)
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:
ChannelOutput.write(Object)
-
getChannelLocation
public NetChannelLocation getChannelLocation()
Description copied from interface:NetworkedReturns the location of theNetworkedChannelInput.- Specified by:
getChannelLocationin interfaceNetworked- Returns:
- the
NetChannelLocationobject. - See Also:
Networked.getChannelLocation()
-
getFactoryClass
public java.lang.Class 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
public void addWriteFilter(Filter filter)
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:
WriteFiltered.addWriteFilter(Filter)
-
addWriteFilter
public void addWriteFilter(Filter filter, int index)
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:
WriteFiltered.addWriteFilter(Filter, int)
-
removeWriteFilter
public void removeWriteFilter(Filter filter)
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:
WriteFiltered.removeWriteFilter(Filter)
-
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:
WriteFiltered.removeWriteFilter(int)
-
getWriteFilter
public Filter getWriteFilter(int index)
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:
WriteFiltered.getWriteFilter(int)
-
getWriteFilterCount
public int getWriteFilterCount()
Description copied from interface:WriteFilteredReturns the number of write filters currently installed.- Specified by:
getWriteFilterCountin 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:
poisonin interfacePoisonable- Parameters:
strength- the strength of the poison (must be >= 0).
-
-