Class OutputReconnectionManagerCNSImpl

  • All Implemented Interfaces:
    java.io.Serializable, OutputReconnectionManager

    class OutputReconnectionManagerCNSImpl
    extends java.lang.Object
    implements 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

      Fields 
      Modifier and Type Field Description
      private NetChannelOutput chanOut
      Underlying networked channel output end.
      private java.lang.String cnsServiceName
      Name of the CNS service to use.
      private int maxAttemptCount
      Constant specifying the maximum number of retry attempts before aborting a write operation.
      private boolean serializable
      true iff the object can be serialized and sent (migrated) to another node.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void dealWithWriteError​(java.lang.Object value, java.lang.RuntimeException e)
      Attempts to resolve the new channel location.
      NetChannelOutput getOutputChannel()
      Returns the underlying channel output end.
      void prepareToMove()
      Prepares the channel end for transfer to another node.
      private void readObject​(java.io.ObjectInputStream in)
      Deserializes this object from an input stream.
      private void writeObject​(java.io.ObjectOutputStream out)
      Serializes this object to the output stream.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • chanOut

        private transient NetChannelOutput chanOut
        Underlying networked channel output end.
      • maxAttemptCount

        private final int maxAttemptCount
        Constant specifying the maximum number of retry attempts before aborting a write operation.
        See Also:
        Constant Field Values
      • serializable

        private transient boolean serializable
        true iff the object can be serialized and sent (migrated) to another node.
      • cnsServiceName

        private java.lang.String cnsServiceName
        Name of the CNS service to use.
    • Constructor Detail

      • OutputReconnectionManagerCNSImpl

        public OutputReconnectionManagerCNSImpl​(NetChannelOutput out)
        Constructs a new OutputReconnectionManagerCNSImpl with the given underlying networked channel output end. The default CNS service name will be used.
        Parameters:
        out - underlying networked channel end.
      • OutputReconnectionManagerCNSImpl

        public OutputReconnectionManagerCNSImpl​(NetChannelOutput out,
                                                java.lang.String cnsServiceName)
        Constructs a new OutputReconnectionManagerCNSImpl 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 Detail

      • dealWithWriteError

        private void dealWithWriteError​(java.lang.Object value,
                                        java.lang.RuntimeException e)
        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 by maxAttemptCount 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.
      • writeObject

        private void writeObject​(java.io.ObjectOutputStream out)
                          throws java.io.IOException
        Serializes this object to the output stream. Before moving this channel end, prepareToMove should be called.
        Parameters:
        out - destination stream to serialize to.
        Throws:
        java.io.IOException - if there is a problem with the output stream.
      • readObject

        private void readObject​(java.io.ObjectInputStream in)
                         throws java.io.IOException,
                                java.lang.ClassNotFoundException
        Deserializes this object from an input stream.
        Parameters:
        in - input stream to read the object from.
        Throws:
        java.io.IOException - if there is a problem with the input stream.
        java.lang.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.