Class KeepAlive

  • All Implemented Interfaces:
    java.lang.Runnable
    Direct Known Subclasses:
    Heartbeater, KeepAliveRunner

    public abstract class KeepAlive
    extends java.lang.Thread
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.lang.Thread

        java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected ConnectionImpl conn  
      protected int keepAliveInterval  
      protected org.slf4j.Logger log  
      • Fields inherited from class java.lang.Thread

        MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected KeepAlive​(ConnectionImpl conn, java.lang.String name)  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected abstract void doKeepAlive()  
      int getKeepAliveInterval()
      Get KeepAlive interval in seconds
      boolean isEnabled()
      KeepAlive enabled based on KeepAlive interval
      void run()  
      void setKeepAliveInterval​(int keepAliveInterval)
      Set KeepAlive interval in seconds
      • Methods inherited from class java.lang.Thread

        activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
      • Methods inherited from class java.lang.Object

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

      • log

        protected final org.slf4j.Logger log
      • keepAliveInterval

        protected int keepAliveInterval
    • Constructor Detail

      • KeepAlive

        protected KeepAlive​(ConnectionImpl conn,
                            java.lang.String name)
    • Method Detail

      • isEnabled

        public boolean isEnabled()
        KeepAlive enabled based on KeepAlive interval
        Returns:
        Enabled when KeepInterval is greater than 0
      • getKeepAliveInterval

        public int getKeepAliveInterval()
        Get KeepAlive interval in seconds
        Returns:
        KeepAlive interval in seconds defaults to 0
      • setKeepAliveInterval

        public void setKeepAliveInterval​(int keepAliveInterval)
        Set KeepAlive interval in seconds
        Parameters:
        keepAliveInterval - KeepAlive interval in seconds
      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
        Overrides:
        run in class java.lang.Thread