Package org.jboss.as.protocol
Class ProtocolConnectionManager
java.lang.Object
org.jboss.as.protocol.ProtocolConnectionManager
A basic connection manager, notifying clients when the connection is closed or shutdown. The
ProtocolConnectionManager.ConnectTask can be used to implement different (re-)connection strategies.- Author:
- Emanuel Muckenhuber
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceHandler for notifications that a connection has been openedstatic interfaceTask used to establish the connection. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ProtocolConnectionManager.ConnectTaskAConnectTaskthat can be returned fromProtocolConnectionManager.ConnectTask.connectionClosed()to terminate further attempts to connect. -
Method Summary
Modifier and TypeMethodDescriptionorg.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.ConnectionGet the connection.booleanCheck if connected.voidshutdown()Shutdown the connection manager.
-
Field Details
-
DISCONNECTED
AConnectTaskthat can be returned fromProtocolConnectionManager.ConnectTask.connectionClosed()to terminate further attempts to connect.
-
-
Method Details
-
isConnected
public boolean isConnected()Check if connected.- Returns:
trueif the connection is open,falseotherwise
-
connect
Get 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
Create a new connection manager.- Parameters:
connectTask- the connect connectTask- Returns:
- the connection manager
-