|
Jive Forums API (5.5.20.2-oracle) Developer Javadocs | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ConnectionManager
Manages and maintains server connections.
Beyond simple access to active connections on the server, the connection manager can ensure connections are alive, and boot connections that are idle according to an idle policy.
Method Summary | |
---|---|
void |
addConnection(Connection conn)
Add a connection to the manager. |
Connection |
createConnection(java.net.Socket socket,
boolean acceptCreated,
boolean secure)
Creates a connection in the manager by wrapping the given socket in an appropriate connection implementation. |
ConnectionMonitor |
getConfigMonitor()
Connection configuration monitors records any changes in a connection's configuration for administration and use in determining runtime behavior. |
ConnectionMonitor |
getConnectedMonitor()
Obtain a monitor that watches the connections as they are added to the manager. |
Connection |
getConnection(int id)
Obtain a connection by it's ID. |
int |
getConnectionCount()
Obtain the number of connections currently managed by this manager. |
java.util.Iterator |
getConnections()
Obtain an iterator of all connections managed by this manager. |
java.util.Iterator |
getConnections(BasicResultFilter filter)
Obtain an iterator of all connections managed by this manager after filtering with the given filter. |
ConnectionMonitor |
getDisconnectedMonitor()
Obtain a monitor that watches the connections as they are removed from the manager. |
int |
getMaxConnections()
Returns the maximum number of connections allowed in the server. |
java.lang.Object |
registerCloseListener(ConnectionCloseListener listener,
java.lang.Object handbackMessage)
Register a listener for close event notification. |
java.lang.Object |
removeCloseListener(ConnectionCloseListener listener)
Remove a registered close event listener. |
void |
removeConnection(Connection conn)
Remove the given connection from the manager. |
void |
setMaxConnections(int maxConnections)
Sets the maximum number of connections allowed in the server. |
void |
stop()
Stop the module. |
Methods inherited from interface com.jivesoftware.base.JiveManager |
---|
destroy, initialize |
Method Detail |
---|
int getMaxConnections()
void setMaxConnections(int maxConnections)
maxConnections
- max number of connections.int getConnectionCount()
java.util.Iterator getConnections()
java.util.Iterator getConnections(BasicResultFilter filter)
filter
- the filter to restrict the connections to return.
Connection getConnection(int id) throws NotFoundException
id
- the ID of the connection to retrieve.
NotFoundException
Connection createConnection(java.net.Socket socket, boolean acceptCreated, boolean secure) throws java.io.IOException
Creates a connection in the manager by wrapping the given socket in an appropriate connection implementation.
Connections should hide their underlying socket implementation. However, in order for the ConnectionManager to properly detect new data for reading on it's connections, it must have the socket of the connection. This is especially important when using nio channels.
NOTE: the connection is created but not added to the connection manager with this method. The connection MUST be added before the connection manager actively manages the connection.
socket
- the socket associated with this connection.acceptCreated
- true if the socket was created with accept.secure
- true if the connection is secure.
java.io.IOException
void addConnection(Connection conn)
Add a connection to the manager.
Connections added to the ConnectionManager are monitored for closing and are automatically added to the idle group by calling Connection.idle() on the added connection. Connections should use the idle() method to add themself to the idle group using addIdleSocket().
Connections should hide their underlying socket implementation. However, in order for the ConnectionManager to properly detect new data for reading on it's connections, it must have the socket of the connection. This is especially important when using nio channels.
conn
- the connection to add to this manager for active managementvoid removeConnection(Connection conn) throws java.lang.InterruptedException
conn
- the connection to remove from the manager.
java.lang.InterruptedException
- if a connection could not be removed because the
manager was interrupted.ConnectionMonitor getConnectedMonitor()
ConnectionMonitor getConfigMonitor()
Connection configuration monitors records any changes in a connection's configuration for administration and use in determining runtime behavior.
Samples are the number of connection changes and the rate is measured in connections per second. Although some administration events may change connection configurations, it is expected that the primary events recorded are in protocol-level connection state changes such as the establishment of TLS over a previously insecure connection via SASL.
ConnectionMonitor getDisconnectedMonitor()
java.lang.Object registerCloseListener(ConnectionCloseListener listener, java.lang.Object handbackMessage) throws UnauthorizedException
listener
- the listener to register for events.handbackMessage
- The object to send in the event notification.
UnauthorizedException
- if caller doesn't have permission to
access this resource.java.lang.Object removeCloseListener(ConnectionCloseListener listener) throws UnauthorizedException
listener
- the listener to deregister for close events.
UnauthorizedException
- if caller doesn't have permission
to access this resource.void stop()
|
Jive Forums Project Page | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |