Class SocketReceiver

    • Field Detail

      • DEFAULT_ACCEPT_CONNECTION_DELAY

        private static final int DEFAULT_ACCEPT_CONNECTION_DELAY
        See Also:
        Constant Field Values
      • remoteHost

        private java.lang.String remoteHost
      • address

        private java.net.InetAddress address
      • port

        private int port
      • reconnectionDelay

        private int reconnectionDelay
      • acceptConnectionTimeout

        private int acceptConnectionTimeout
      • receiverId

        private java.lang.String receiverId
      • socket

        private volatile java.net.Socket socket
      • connectorTask

        private java.util.concurrent.Future<java.net.Socket> connectorTask
    • Constructor Detail

      • SocketReceiver

        public SocketReceiver()
    • Method Detail

      • shouldStart

        protected boolean shouldStart()
        Determines whether this receiver should start.

        Subclasses will implement this method to do any subclass-specific validation. The subclass's ReceiverBase.getRunnableTask() method will be invoked (and the task returned will be submitted to the executor) if and only if this method returns true

        Specified by:
        shouldStart in class ReceiverBase
        Returns:
        flag indicating whether this receiver should start
      • onStop

        protected void onStop()
        Allows a subclass to participate in receiver shutdown.
        Specified by:
        onStop in class ReceiverBase
      • getRunnableTask

        protected java.lang.Runnable getRunnableTask()
        Description copied from class: ReceiverBase
        Provides the runnable task this receiver will execute.
        Specified by:
        getRunnableTask in class ReceiverBase
        Returns:
        runnable task
      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
      • createConnector

        private SocketConnector createConnector​(java.net.InetAddress address,
                                                int port,
                                                int initialDelay,
                                                int retryDelay)
      • activateConnector

        private java.util.concurrent.Future<java.net.Socket> activateConnector​(SocketConnector connector)
      • waitForConnectorToReturnASocket

        private java.net.Socket waitForConnectorToReturnASocket()
                                                         throws java.lang.InterruptedException
        Throws:
        java.lang.InterruptedException
      • dispatchEvents

        private void dispatchEvents​(LoggerContext lc)
      • newConnector

        protected SocketConnector newConnector​(java.net.InetAddress address,
                                               int port,
                                               int initialDelay,
                                               int retryDelay)
      • getSocketFactory

        protected javax.net.SocketFactory getSocketFactory()
      • setRemoteHost

        public void setRemoteHost​(java.lang.String remoteHost)
      • setPort

        public void setPort​(int port)
      • setReconnectionDelay

        public void setReconnectionDelay​(int reconnectionDelay)
      • setAcceptConnectionTimeout

        public void setAcceptConnectionTimeout​(int acceptConnectionTimeout)