Class ConnectionManager

java.lang.Object
org.jline.builtins.telnet.ConnectionManager
All Implemented Interfaces:
Runnable

public abstract class ConnectionManager extends Object implements Runnable
Class that takes care for active and queued connection. Housekeeping is done also for connections that were just broken off, or exceeded their timeout.
Version:
2.0 (16/07/2006)
  • Field Details

    • LOG

      private static Logger LOG
    • openConnections

      private final List<Connection> openConnections
    • thread

      private Thread thread
    • threadGroup

      private ThreadGroup threadGroup
    • closedConnections

      private Stack<Connection> closedConnections
    • connectionFilter

      private ConnectionFilter connectionFilter
    • maxConnections

      private int maxConnections
    • warningTimeout

      private int warningTimeout
    • disconnectTimeout

      private int disconnectTimeout
    • housekeepingInterval

      private int housekeepingInterval
    • loginShell

      private String loginShell
    • lineMode

      private boolean lineMode
    • stopping

      private boolean stopping
  • Constructor Details

    • ConnectionManager

      public ConnectionManager()
    • ConnectionManager

      public ConnectionManager(int con, int timew, int timedis, int hoke, ConnectionFilter filter, String lsh, boolean lm)
  • Method Details

    • getConnectionFilter

      public ConnectionFilter getConnectionFilter()
      Gets the active ConnectionFilter instance or returns null if no filter is set.
      Returns:
      the managers ConnectionFilter.
    • setConnectionFilter

      public void setConnectionFilter(ConnectionFilter filter)
      Set a connection filter for this ConnectionManager instance. The filter is used to handle IP level allow/deny of incoming connections.
      Parameters:
      filter - ConnectionFilter instance.
    • openConnectionCount

      public int openConnectionCount()
      Returns the number of open connections.
      Returns:
      the number of open connections as int.
    • getConnection

      public Connection getConnection(int idx)
      Returns the Connection at the given index.
      Parameters:
      idx - the index
      Returns:
      the connection
    • getConnectionsByAdddress

      public Connection[] getConnectionsByAdddress(InetAddress addr)
      Get all Connection instances with the given InetAddress.
      Parameters:
      addr - the address
      Returns:
      all Connection instances with the given InetAddress.
    • start

      public void start()
      Starts this ConnectionManager.
    • stop

      public void stop()
      Stops this ConnectionManager.
    • makeConnection

      public void makeConnection(Socket insock)
      Method that that tries to connect an incoming request. Properly queueing.
      Parameters:
      insock - Socket thats representing the incoming connection.
    • createConnection

      protected abstract Connection createConnection(ThreadGroup threadGroup, ConnectionData newCD)
    • run

      public void run()
      Periodically does following work:
      • cleaning up died connections.
      • checking managed connections if they are working properly.
      • checking the open connections.
      Specified by:
      run in interface Runnable
    • cleanupClosed

      private void cleanupClosed()
    • checkOpenConnections

      private void checkOpenConnections()
    • registerClosedConnection

      public void registerClosedConnection(Connection con)
    • getDisconnectTimeout

      public int getDisconnectTimeout()
    • setDisconnectTimeout

      public void setDisconnectTimeout(int disconnectTimeout)
    • getHousekeepingInterval

      public int getHousekeepingInterval()
    • setHousekeepingInterval

      public void setHousekeepingInterval(int housekeepingInterval)
    • isLineMode

      public boolean isLineMode()
    • setLineMode

      public void setLineMode(boolean lineMode)
    • getLoginShell

      public String getLoginShell()
    • setLoginShell

      public void setLoginShell(String loginShell)
    • getMaxConnections

      public int getMaxConnections()
    • setMaxConnections

      public void setMaxConnections(int maxConnections)
    • getWarningTimeout

      public int getWarningTimeout()
    • setWarningTimeout

      public void setWarningTimeout(int warningTimeout)