|
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 |
java.lang.Objectcom.jivesoftware.forum.net.spi.AbstractConnectionManager
public abstract class AbstractConnectionManager
A basic connection manager implementation.
The abstract connection manager handles all of the house keeping and configuration associated with the Connection Manager. Most implementations need only extend and implement the getReaderFactory() method to specialize the connection manager to handle a particular protocol.
Constructor Summary | |
---|---|
AbstractConnectionManager()
Constructs a manager with default values. |
Method Summary | |
---|---|
void |
addConnection(Connection con)
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. |
void |
destroy()
Notifies the manager to release any resources that may be holding on too. |
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. |
void |
initialize()
Initialize the manager. |
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 class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractConnectionManager()
Method Detail |
---|
public void initialize()
JiveManager
This method is used internally by Jive during application startup and should not be called during normal usage of the class.
initialize
in interface JiveManager
public void destroy()
JiveManager
destroy
in interface JiveManager
public int getMaxConnections()
ConnectionManager
getMaxConnections
in interface ConnectionManager
public void setMaxConnections(int maxConnections)
ConnectionManager
setMaxConnections
in interface ConnectionManager
maxConnections
- max number of connections.public int getConnectionCount()
ConnectionManager
getConnectionCount
in interface ConnectionManager
public java.util.Iterator getConnections()
ConnectionManager
getConnections
in interface ConnectionManager
public java.util.Iterator getConnections(BasicResultFilter filter)
ConnectionManager
getConnections
in interface ConnectionManager
filter
- the filter to restrict the connections to return.
public Connection getConnection(int id) throws NotFoundException
ConnectionManager
getConnection
in interface ConnectionManager
id
- the ID of the connection to retrieve.
NotFoundException
public Connection createConnection(java.net.Socket socket, boolean acceptCreated, boolean secure) throws java.io.IOException
ConnectionManager
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.
createConnection
in interface ConnectionManager
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
public void addConnection(Connection con)
ConnectionManager
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.
addConnection
in interface ConnectionManager
con
- the connection to add to this manager for active managementpublic void removeConnection(Connection conn) throws java.lang.IllegalStateException
ConnectionManager
removeConnection
in interface ConnectionManager
conn
- the connection to remove from the manager.
java.lang.IllegalStateException
public ConnectionMonitor getConnectedMonitor()
ConnectionManager
getConnectedMonitor
in interface ConnectionManager
public ConnectionMonitor getConfigMonitor()
ConnectionManager
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.
getConfigMonitor
in interface ConnectionManager
public ConnectionMonitor getDisconnectedMonitor()
ConnectionManager
getDisconnectedMonitor
in interface ConnectionManager
public java.lang.Object registerCloseListener(ConnectionCloseListener listener, java.lang.Object handbackMessage) throws UnauthorizedException
ConnectionManager
registerCloseListener
in interface ConnectionManager
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.public java.lang.Object removeCloseListener(ConnectionCloseListener listener) throws UnauthorizedException
ConnectionManager
removeCloseListener
in interface ConnectionManager
listener
- the listener to deregister for close events.
UnauthorizedException
- if caller doesn't have permission
to access this resource.public void stop()
ConnectionManager
stop
in interface ConnectionManager
|
Jive Forums Project Page | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |