Class ReliableTcpConnection


  • public class ReliableTcpConnection
    extends Object
    • Field Detail

      • logger

        private static final org.objectweb.util.monolog.api.Logger logger
      • statusNames

        private static final String[] statusNames
      • WINDOW_SIZE_PROP_NAME

        public static String WINDOW_SIZE_PROP_NAME
      • DEFAULT_WINDOW_SIZE

        public static int DEFAULT_WINDOW_SIZE
      • windowSize

        private int windowSize
        Maximum number of non acknowledged messages
      • unackCounter

        private volatile int unackCounter
        Counter of received messages that needs an acknowledge. The messages received are acknowledged each time a message is sent (sending of the stamp of the last message received). This counter is incremented when a message is received, and reseted when a message is sent (acknowledgment of all messages received). When the number of messages waiting an acknowledgment is too high (windowSize) an empty message is sent to explicitly acknowledge them. TODO (AF): This field should be synchronized, currently collisions may occur during counter increments. The consequence is that the actual value of the counter may be less than the actual value. In the current implementation this is not a problem.
      • inputCounter

        private volatile long inputCounter
      • outputCounter

        private long outputCounter
      • inputLock

        private Object inputLock
      • outputLock

        private Object outputLock
      • status

        private int status
      • timer

        private Timer timer
      • noAckedQueue

        private boolean noAckedQueue
    • Constructor Detail

      • ReliableTcpConnection

        public ReliableTcpConnection​(Timer timer,
                                     boolean noAckedQueue)
    • Method Detail

      • setStatus

        private void setStatus​(int status)
      • getStatus

        private final int getStatus()
      • send

        public void send​(org.objectweb.joram.shared.client.AbstractJmsMessage request)
                  throws IOException
        Throws:
        IOException
      • doSend

        private void doSend​(long id,
                            long ackId,
                            org.objectweb.joram.shared.client.AbstractJmsMessage msg)
                     throws IOException
        Throws:
        IOException
      • ackPendingMessages

        private void ackPendingMessages​(long ackId)
      • receive

        public org.objectweb.joram.shared.client.AbstractJmsReply receive()
                                                                   throws Exception
        Throws:
        Exception
      • isReaderRun

        public boolean isReaderRun()
      • close

        public void close()