Class TcpPingInterceptor

    • Field Detail

      • sm

        protected static final StringManager sm
        The string manager for this package.
      • TCP_PING_DATA

        protected static final byte[] TCP_PING_DATA
        Test payload sent during ping checks.
      • interval

        protected long interval
        Ping interval in milliseconds.
      • useThread

        protected boolean useThread
        Whether to use a dedicated thread for pinging.
      • staticOnly

        protected boolean staticOnly
        Whether to ping only static members.
      • running

        protected volatile boolean running
        Whether the ping thread is currently running.
      • cnt

        protected static final java.util.concurrent.atomic.AtomicInteger cnt
        Counter for naming ping threads.
    • Constructor Detail

      • TcpPingInterceptor

        public TcpPingInterceptor()
        Constructs a new TcpPingInterceptor.
    • Method Detail

      • start

        public void start​(int svc)
                   throws ChannelException
        Description copied from interface: ChannelInterceptor
        Starts up the channel. This can be called multiple times for individual services to start The svc parameter can be the logical or value of any constants
        Specified by:
        start in interface ChannelInterceptor
        Overrides:
        start in class ChannelInterceptorBase
        Parameters:
        svc - one of:
        • Channel.DEFAULT - will start all services
        • Channel.MBR_RX_SEQ - starts the membership receiver
        • Channel.MBR_TX_SEQ - starts the membership broadcaster
        • Channel.SND_TX_SEQ - starts the replication transmitter
        • Channel.SND_RX_SEQ - starts the replication receiver
        Throws:
        ChannelException - if a startup error occurs or the service is already started.
        See Also:
        Channel
      • stop

        public void stop​(int svc)
                  throws ChannelException
        Description copied from interface: ChannelInterceptor
        Shuts down the channel. This can be called multiple times for individual services to shut down. The svc parameter can be the logical or value of any constants
        Specified by:
        stop in interface ChannelInterceptor
        Overrides:
        stop in class ChannelInterceptorBase
        Parameters:
        svc - one of:
        • Channel.DEFAULT - will shut down all services
        • Channel.MBR_RX_SEQ - stops the membership receiver
        • Channel.MBR_TX_SEQ - stops the membership broadcaster
        • Channel.SND_TX_SEQ - stops the replication transmitter
        • Channel.SND_RX_SEQ - stops the replication receiver
        Throws:
        ChannelException - if a startup error occurs or the service is already started.
        See Also:
        Channel
      • setInterval

        public void setInterval​(long interval)
        Sets the ping interval in milliseconds.
        Parameters:
        interval - the interval in milliseconds
      • setUseThread

        public void setUseThread​(boolean useThread)
        Sets whether to use a dedicated thread for pinging.
        Parameters:
        useThread - true to use a dedicated thread
      • setStaticOnly

        public void setStaticOnly​(boolean staticOnly)
        Sets whether to ping only static members.
        Parameters:
        staticOnly - true to ping only static members
      • getStaticOnly

        public boolean getStaticOnly()
        Returns whether static-only mode is enabled.
        Returns:
        true if only static members are pinged
      • sendPing

        protected void sendPing()
        Sends a ping to cluster members.
      • sendPingMessage

        protected void sendPingMessage​(Member[] members)
        Sends a ping message to the specified members.
        Parameters:
        members - the members to ping