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 String
Unique prefix to use when registering channels with the CNS.private NetAltingChannelInput
The underlying input channel end.(package private) Class
The factory class used to create the channel end.private NetChannelLocation
Current location of the channel.private String
Name registered with the CNS.private NameAccessLevel
NameAccessLevel
used to register the name against with the CNS.private String
Identification of the CNS service to use.private ChannelNameKey
The name key allocated to the channel.private static final int
Constant for representing a possible channel state.private static final int
Constant for representing a possible channel state.private static final int
Constant for representing a possible channel state.private boolean
True if the channel end has been prepared for serialization (migration). -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a newInputReconnectionManagerCNSImpl
for use with the given input channel.InputReconnectionManagerCNSImpl
(NetAltingChannelInput chanIn, String cnsServiceName) Constructs a newInputReconnectionManagerCNSImpl
for use with the given input channel and a specific CNS service.InputReconnectionManagerCNSImpl
(NetAltingChannelInput chanIn, String name, NameAccessLevel accessLevel, ChannelNameKey key) Constructs a newInputReconnectionManagerCNSImpl
for use with CNS registered channels usingNameAccessLevel
application isolation.InputReconnectionManagerCNSImpl
(NetAltingChannelInput chanIn, String name, NameAccessLevel accessLevel, ChannelNameKey key, String cnsServiceName) Constructs a newInputReconnectionManagerCNSImpl
for use with CNS registered channels. -
Method Summary
Modifier and TypeMethodDescriptionReturns the current location of the channel.Obtain theNetAltingChannelInput
object to use.void
This method must be called before an instance of this class is serializable.private void
Serialization method to read this object from a stream.private void
Serialization 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
NameAccessLevel
used 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 newInputReconnectionManagerCNSImpl
for use with the given input channel. The default CNS service name will be used.- Parameters:
chanIn
- the input channel end.
-
InputReconnectionManagerCNSImpl
Constructs a newInputReconnectionManagerCNSImpl
for 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 newInputReconnectionManagerCNSImpl
for use with CNS registered channels usingNameAccessLevel
application 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 newInputReconnectionManagerCNSImpl
for 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 theNetAltingChannelInput
object 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, aChannelEndContructionException
will be thrown.- Specified by:
getInputChannel
in 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:
getCurrentLocation
in 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:
prepareToMove
in 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:
IOException
ClassNotFoundException
-