Package org.jline.builtins.telnet
Class ConnectionManager
- java.lang.Object
-
- org.jline.builtins.telnet.ConnectionManager
-
- All Implemented Interfaces:
java.lang.Runnable
public abstract class ConnectionManager extends java.lang.Object implements java.lang.RunnableClass 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)
- Author:
- Dieter Wimberger
-
-
Constructor Summary
Constructors Constructor Description ConnectionManager()ConnectionManager(int con, int timew, int timedis, int hoke, ConnectionFilter filter, java.lang.String lsh, boolean lm)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract ConnectioncreateConnection(java.lang.ThreadGroup threadGroup, ConnectionData newCD)ConnectiongetConnection(int idx)Returns theConnectionat the given index.ConnectionFiltergetConnectionFilter()Gets the active ConnectionFilter instance or returns null if no filter is set.Connection[]getConnectionsByAdddress(java.net.InetAddress addr)Get allConnectioninstances with the givenInetAddress.intgetDisconnectTimeout()intgetHousekeepingInterval()java.lang.StringgetLoginShell()intgetMaxConnections()intgetWarningTimeout()booleanisLineMode()voidmakeConnection(java.net.Socket insock)Method that that tries to connect an incoming request.intopenConnectionCount()Returns the number of open connections.voidregisterClosedConnection(Connection con)voidrun()Periodically does following work: cleaning up died connections.voidsetConnectionFilter(ConnectionFilter filter)Set a connection filter for this ConnectionManager instance.voidsetDisconnectTimeout(int disconnectTimeout)voidsetHousekeepingInterval(int housekeepingInterval)voidsetLineMode(boolean lineMode)voidsetLoginShell(java.lang.String loginShell)voidsetMaxConnections(int maxConnections)voidsetWarningTimeout(int warningTimeout)voidstart()Starts thisConnectionManager.voidstop()Stops thisConnectionManager.
-
-
-
Constructor Detail
-
ConnectionManager
public ConnectionManager()
-
ConnectionManager
public ConnectionManager(int con, int timew, int timedis, int hoke, ConnectionFilter filter, java.lang.String lsh, boolean lm)
-
-
Method Detail
-
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 theConnectionat the given index.- Parameters:
idx- the index- Returns:
- the connection
-
getConnectionsByAdddress
public Connection[] getConnectionsByAdddress(java.net.InetAddress addr)
Get allConnectioninstances with the givenInetAddress.- Parameters:
addr- the address- Returns:
- all
Connectioninstances with the givenInetAddress.
-
start
public void start()
Starts thisConnectionManager.
-
stop
public void stop()
Stops thisConnectionManager.
-
makeConnection
public void makeConnection(java.net.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(java.lang.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:
runin interfacejava.lang.Runnable
-
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 java.lang.String getLoginShell()
-
setLoginShell
public void setLoginShell(java.lang.String loginShell)
-
getMaxConnections
public int getMaxConnections()
-
setMaxConnections
public void setMaxConnections(int maxConnections)
-
getWarningTimeout
public int getWarningTimeout()
-
setWarningTimeout
public void setWarningTimeout(int warningTimeout)
-
-