Package org.jboss.as.protocol
Class ProtocolConnectionManager
- java.lang.Object
-
- org.jboss.as.protocol.ProtocolConnectionManager
-
public final class ProtocolConnectionManager extends Object
A basic connection manager, notifying clients when the connection is closed or shutdown. TheProtocolConnectionManager.ConnectTaskcan be used to implement different (re-)connection strategies.- Author:
- Emanuel Muckenhuber
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceProtocolConnectionManager.ConnectionOpenHandlerHandler for notifications that a connection has been openedstatic interfaceProtocolConnectionManager.ConnectTaskTask used to establish the connection.
-
Field Summary
Fields Modifier and Type Field Description static ProtocolConnectionManager.ConnectTaskDISCONNECTEDAConnectTaskthat can be returned fromProtocolConnectionManager.ConnectTask.connectionClosed()to terminate further attempts to connect.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.jboss.remoting3.Connectionconnect()Get the connection.static ProtocolConnectionManagercreate(ProtocolConnectionConfiguration configuration, ProtocolConnectionManager.ConnectionOpenHandler openHandler)Create a new connection manager, which will try to connect using the protocol connection configuration.static ProtocolConnectionManagercreate(ProtocolConnectionConfiguration configuration, ProtocolConnectionManager.ConnectionOpenHandler openHandler, ProtocolConnectionManager.ConnectTask next)Create a new connection manager, which will try to connect using the protocol connection configuration.static ProtocolConnectionManagercreate(ProtocolConnectionManager.ConnectTask connectTask)Create a new connection manager.static ProtocolConnectionManagercreate(org.jboss.remoting3.Connection connection, ProtocolConnectionManager.ConnectionOpenHandler openHandler)Create a new connection manager, based on an existing connection.org.jboss.remoting3.ConnectiongetConnection()Get the connection.booleanisConnected()Check if connected.voidshutdown()Shutdown the connection manager.
-
-
-
Field Detail
-
DISCONNECTED
public static final ProtocolConnectionManager.ConnectTask DISCONNECTED
AConnectTaskthat can be returned fromProtocolConnectionManager.ConnectTask.connectionClosed()to terminate further attempts to connect.
-
-
Method Detail
-
isConnected
public boolean isConnected()
Check if connected.- Returns:
trueif the connection is open,falseotherwise
-
connect
public org.jboss.remoting3.Connection connect() throws IOExceptionGet the connection. If not connected, theConnectTaskwill be used to establish a connection.- Returns:
- the connection
- Throws:
IOException
-
getConnection
public org.jboss.remoting3.Connection getConnection()
Get the connection.- Returns:
- the connection
-
shutdown
public void shutdown()
Shutdown the connection manager.
-
create
public static ProtocolConnectionManager create(org.jboss.remoting3.Connection connection, ProtocolConnectionManager.ConnectionOpenHandler openHandler)
Create a new connection manager, based on an existing connection.- Parameters:
connection- the existing connectionopenHandler- a connection open handler- Returns:
- the connected manager
-
create
public static ProtocolConnectionManager create(ProtocolConnectionConfiguration configuration, ProtocolConnectionManager.ConnectionOpenHandler openHandler)
Create a new connection manager, which will try to connect using the protocol connection configuration.- Parameters:
configuration- the connection configurationopenHandler- the connection open handler- Returns:
- the connection manager
-
create
public static ProtocolConnectionManager create(ProtocolConnectionConfiguration configuration, ProtocolConnectionManager.ConnectionOpenHandler openHandler, ProtocolConnectionManager.ConnectTask next)
Create a new connection manager, which will try to connect using the protocol connection configuration.- Parameters:
configuration- the connection configurationopenHandler- the connection open handlernext- the next connect connectTask used once disconnected- Returns:
- the connection manager
-
create
public static ProtocolConnectionManager create(ProtocolConnectionManager.ConnectTask connectTask)
Create a new connection manager.- Parameters:
connectTask- the connect connectTask- Returns:
- the connection manager
-
-