Package org.jcsp.net.dynamic
Class OutputReconnectionManagerCNSImpl
java.lang.Object
org.jcsp.net.dynamic.OutputReconnectionManagerCNSImpl
- All Implemented Interfaces:
Serializable
,OutputReconnectionManager
Implementation of the output reconnection manager that uses a CNS service to track channel ends.
If this class is used for the output end,
InputReconnectionManagerCNSImpl
should be
used at the input end.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate NetChannelOutput
Underlying networked channel output end.private String
Name of the CNS service to use.private final int
Constant specifying the maximum number of retry attempts before aborting a write operation.private boolean
true
iff the object can be serialized and sent (migrated) to another node. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a newOutputReconnectionManagerCNSImpl
with the given underlying networked channel output end.OutputReconnectionManagerCNSImpl
(NetChannelOutput out, String cnsServiceName) Constructs a newOutputReconnectionManagerCNSImpl
with the given underlying networked channel output end using a specific CNS service. -
Method Summary
Modifier and TypeMethodDescriptionprivate void
dealWithWriteError
(Object value, RuntimeException e) Attempts to resolve the new channel location.Returns the underlying channel output end.void
Prepares the channel end for transfer to another node.private void
Deserializes this object from an input stream.private void
Serializes this object to the output stream.
-
Field Details
-
chanOut
Underlying networked channel output end. -
maxAttemptCount
private final int maxAttemptCountConstant specifying the maximum number of retry attempts before aborting a write operation.- See Also:
-
serializable
private transient boolean serializabletrue
iff the object can be serialized and sent (migrated) to another node. -
cnsServiceName
Name of the CNS service to use.
-
-
Constructor Details
-
OutputReconnectionManagerCNSImpl
Constructs a newOutputReconnectionManagerCNSImpl
with the given underlying networked channel output end. The default CNS service name will be used.- Parameters:
out
- underlying networked channel end.
-
OutputReconnectionManagerCNSImpl
Constructs a newOutputReconnectionManagerCNSImpl
with the given underlying networked channel output end using a specific CNS service.- Parameters:
out
- the underlying networked channel end.cnsServiceName
- name of the CNS service to use.
-
-
Method Details
-
getOutputChannel
Description copied from interface:OutputReconnectionManager
Returns the underlying channel output end.- Specified by:
getOutputChannel
in interfaceOutputReconnectionManager
- See Also:
-
dealWithWriteError
Attempts to resolve the new channel location. This method is called when a write error occurs because the destination is no longer valid. The CNS service is queried to find out where the other channel end moved to. A number of attempts to write to the new location are made. If these fail, the channel is recreated. If the number of retry attempts exceeds the limit set bymaxAttemptCount
the write is considered to have failed and the original exception is rethrown.- Parameters:
value
- the data value that the user was trying to write and that should be written.e
- the exception originally raised to be thrown if the channel cannot be reconnected.
-
prepareToMove
public void prepareToMove()Description copied from interface:OutputReconnectionManager
Prepares the channel end for transfer to another node.- Specified by:
prepareToMove
in interfaceOutputReconnectionManager
- See Also:
-
writeObject
Serializes this object to the output stream. Before moving this channel end,prepareToMove
should be called.- Parameters:
out
- destination stream to serialize to.- Throws:
IOException
- if there is a problem with the output stream.
-
readObject
Deserializes this object from an input stream.- Parameters:
in
- input stream to read the object from.- Throws:
IOException
- if there is a problem with the input stream.ClassNotFoundException
- if the class definition for the channel implementation cannot be found. This is only likely to occur if there are different versions of the infrastructure library on each node.
-