Package org.jline.builtins.telnet
Class ConnectionManager
java.lang.Object
org.jline.builtins.telnet.ConnectionManager
- All Implemented Interfaces:
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 Summary
FieldsModifier and TypeFieldDescriptionprivate Stack<Connection>
private ConnectionFilter
private int
private int
private boolean
private static Logger
private String
private int
private final List<Connection>
private boolean
private Thread
private ThreadGroup
private int
-
Constructor Summary
ConstructorsConstructorDescriptionConnectionManager
(int con, int timew, int timedis, int hoke, ConnectionFilter filter, String lsh, boolean lm) -
Method Summary
Modifier and TypeMethodDescriptionprivate void
private void
protected abstract Connection
createConnection
(ThreadGroup threadGroup, ConnectionData newCD) getConnection
(int idx) Returns theConnection
at the given index.Gets the active ConnectionFilter instance or returns null if no filter is set.Get allConnection
instances with the givenInetAddress
.int
int
int
int
boolean
void
makeConnection
(Socket insock) Method that that tries to connect an incoming request.int
Returns the number of open connections.void
void
run()
Periodically does following work: cleaning up died connections.void
setConnectionFilter
(ConnectionFilter filter) Set a connection filter for this ConnectionManager instance.void
setDisconnectTimeout
(int disconnectTimeout) void
setHousekeepingInterval
(int housekeepingInterval) void
setLineMode
(boolean lineMode) void
setLoginShell
(String loginShell) void
setMaxConnections
(int maxConnections) void
setWarningTimeout
(int warningTimeout) void
start()
Starts thisConnectionManager
.void
stop()
Stops thisConnectionManager
.
-
Field Details
-
LOG
-
openConnections
-
thread
-
threadGroup
-
closedConnections
-
connectionFilter
-
maxConnections
private int maxConnections -
warningTimeout
private int warningTimeout -
disconnectTimeout
private int disconnectTimeout -
housekeepingInterval
private int housekeepingInterval -
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
Gets the active ConnectionFilter instance or returns null if no filter is set.- Returns:
- the managers ConnectionFilter.
-
setConnectionFilter
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
Returns theConnection
at the given index.- Parameters:
idx
- the index- Returns:
- the connection
-
getConnectionsByAdddress
Get allConnection
instances with the givenInetAddress
.- Parameters:
addr
- the address- Returns:
- all
Connection
instances with the givenInetAddress
.
-
start
public void start()Starts thisConnectionManager
. -
stop
public void stop()Stops thisConnectionManager
. -
makeConnection
Method that that tries to connect an incoming request. Properly queueing.- Parameters:
insock
- Socket thats representing the incoming connection.
-
createConnection
-
run
public void run()Periodically does following work:- cleaning up died connections.
- checking managed connections if they are working properly.
- checking the open connections.
-
cleanupClosed
private void cleanupClosed() -
checkOpenConnections
private void checkOpenConnections() -
registerClosedConnection
-
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
-
setLoginShell
-
getMaxConnections
public int getMaxConnections() -
setMaxConnections
public void setMaxConnections(int maxConnections) -
getWarningTimeout
public int getWarningTimeout() -
setWarningTimeout
public void setWarningTimeout(int warningTimeout)
-