Package org.jcsp.net.dynamic
Class InputReconnectionManagerCNSImpl
java.lang.Object
org.jcsp.net.dynamic.InputReconnectionManagerCNSImpl
- All Implemented Interfaces:
Serializable,InputReconnectionManager
Implementation of the
InputReconnectionManager to work with a CNS service for resolution
of the channel's current location.-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final StringUnique prefix to use when registering channels with the CNS.private NetAltingChannelInputThe underlying input channel end.(package private) ClassThe factory class used to create the channel end.private NetChannelLocationCurrent location of the channel.private StringName registered with the CNS.private NameAccessLevelNameAccessLevelused to register the name against with the CNS.private StringIdentification of the CNS service to use.private ChannelNameKeyThe name key allocated to the channel.private static final intConstant for representing a possible channel state.private static final intConstant for representing a possible channel state.private static final intConstant for representing a possible channel state.private booleanTrue if the channel end has been prepared for serialization (migration). -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a newInputReconnectionManagerCNSImplfor use with the given input channel.InputReconnectionManagerCNSImpl(NetAltingChannelInput chanIn, String cnsServiceName) Constructs a newInputReconnectionManagerCNSImplfor use with the given input channel and a specific CNS service.InputReconnectionManagerCNSImpl(NetAltingChannelInput chanIn, String name, NameAccessLevel accessLevel, ChannelNameKey key) Constructs a newInputReconnectionManagerCNSImplfor use with CNS registered channels usingNameAccessLevelapplication isolation.InputReconnectionManagerCNSImpl(NetAltingChannelInput chanIn, String name, NameAccessLevel accessLevel, ChannelNameKey key, String cnsServiceName) Constructs a newInputReconnectionManagerCNSImplfor use with CNS registered channels. -
Method Summary
Modifier and TypeMethodDescriptionReturns the current location of the channel.Obtain theNetAltingChannelInputobject to use.voidThis method must be called before an instance of this class is serializable.private voidSerialization method to read this object from a stream.private voidSerialization method to write this object to a stream.
-
Field Details
-
chanIn
The underlying input channel end. -
channelFactoryClass
Class channelFactoryClassThe factory class used to create the channel end. -
cnsServiceNameToUse
Identification of the CNS service to use. -
cnsRegisteredName
Name registered with the CNS. -
cnsRegisteredNameAccessLevel
NameAccessLevelused to register the name against with the CNS. -
key
The name key allocated to the channel. -
serializable
private transient boolean serializableTrue if the channel end has been prepared for serialization (migration). -
cnsNetChannelLocation
Current location of the channel. -
MSG_CHAN_SERIALIZABLE
private static final int MSG_CHAN_SERIALIZABLEConstant for representing a possible channel state.- See Also:
-
MSG_CHAN_NETWORKED
private static final int MSG_CHAN_NETWORKEDConstant for representing a possible channel state.- See Also:
-
MSG_TERMINATE
private static final int MSG_TERMINATEConstant for representing a possible channel state.- See Also:
-
anonymousCnsNamePrefix
Unique prefix to use when registering channels with the CNS. It is assumed that only the reconnection managers will be using channels with names of this form.- See Also:
-
-
Constructor Details
-
InputReconnectionManagerCNSImpl
Constructs a newInputReconnectionManagerCNSImplfor use with the given input channel. The default CNS service name will be used.- Parameters:
chanIn- the input channel end.
-
InputReconnectionManagerCNSImpl
Constructs a newInputReconnectionManagerCNSImplfor use with the given input channel and a specific CNS service.- Parameters:
chanIn- the input channel end.cnsServiceName- name of the CNS service to use.
-
InputReconnectionManagerCNSImpl
public InputReconnectionManagerCNSImpl(NetAltingChannelInput chanIn, String name, NameAccessLevel accessLevel, ChannelNameKey key) Constructs a newInputReconnectionManagerCNSImplfor use with CNS registered channels usingNameAccessLevelapplication isolation. The default CNS service name is used.- Parameters:
chanIn- the input channel end.name- the CNS registered name of the channel.accessLevel- the application isolation level.key- the allocated channel key.
-
InputReconnectionManagerCNSImpl
public InputReconnectionManagerCNSImpl(NetAltingChannelInput chanIn, String name, NameAccessLevel accessLevel, ChannelNameKey key, String cnsServiceName) Constructs a newInputReconnectionManagerCNSImplfor use with CNS registered channels.- Parameters:
chanIn- the input channel end.name- the CNS registered name of the channel.accessLevel- the application isolation level.key- the allocated channel key.cnsServiceName- name of the CNS service to use.
-
-
Method Details
-
getInputChannel
Obtain theNetAltingChannelInputobject to use. After serialization, the first call to this method will reconstruct the channel and register it with the CNS. If there is a problem while trying to construct a channel, aChannelEndContructionExceptionwill be thrown.- Specified by:
getInputChannelin interfaceInputReconnectionManager- See Also:
-
getCurrentLocation
Returns the current location of the channel. This method can only be called aftergetInputChannel()has been called to resolve the channel being managed.- Specified by:
getCurrentLocationin interfaceInputReconnectionManager
-
prepareToMove
public void prepareToMove()This method must be called before an instance of this class is serializable. If an instance is deserialized, it can be reserialized without calling this method ifgetInputChannel()has not been called.- Specified by:
prepareToMovein interfaceInputReconnectionManager- See Also:
-
writeObject
Serialization method to write this object to a stream.- Parameters:
out- destination stream to serialize to.- Throws:
IOException
-
readObject
Serialization method to read this object from a stream.- Parameters:
in- the source stream.- Throws:
IOExceptionClassNotFoundException
-