Interface GridClientConnectionManager
-
- All Known Implementing Classes:
GridClientConnectionManagerAdapter,GridClientConnectionManagerOsImpl
public interface GridClientConnectionManagerCommon interface for client connection managers.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description GridClientConnectionconnection(Collection<InetSocketAddress> srvs)Returns connection to node using given server addresses.GridClientConnectionconnection(GridClientNode node)Returns connection to the given node.voidinit(Collection<InetSocketAddress> srvs)Tries to open initial connection and fetch topology using given server addresses.voidstop(boolean waitCompletion)Stops this instance of connection manager and terminates all connections.voidterminateConnection(GridClientConnection conn, @Nullable GridClientNode node, Throwable e)Callback method, which should be called by clients when they get connectivity errors.
-
-
-
Method Detail
-
init
void init(Collection<InetSocketAddress> srvs) throws GridClientException, InterruptedException
Tries to open initial connection and fetch topology using given server addresses.- Parameters:
srvs- Collectionserver addresses. - Throws:
GridClientAuthenticationException- If connection failed to authenticate on server.GridClientException- If manager failed to initialise,InterruptedException- If manager was interrupted while waiting for connection.
-
connection
GridClientConnection connection(GridClientNode node) throws GridServerUnreachableException, GridClientClosedException, InterruptedException
Returns connection to the given node.- Parameters:
node- Node to connect with.- Returns:
- Connection to use for operations, targeted for the given node.
- Throws:
GridServerUnreachableException- If connection can't be established.InterruptedException- If manager was interrupted while waiting for connection to be established.GridClientClosedException- If connection manager has been closed.
-
terminateConnection
void terminateConnection(GridClientConnection conn, @Nullable @Nullable GridClientNode node, Throwable e)
Callback method, which should be called by clients when they get connectivity errors. It's main purpose is to allow connection manager to terminate broken connection early and, try to establish a new one for the consequentconnection(GridClientNode)calls.- Parameters:
conn- Failed connection.node- Connected node.e- Error that caused connection termination.
-
stop
void stop(boolean waitCompletion)
Stops this instance of connection manager and terminates all connections.- Parameters:
waitCompletion- Iftruethis method awaits termination of all connections (and receiving responses for all pending requests), otherwise it will return immediately.
-
connection
GridClientConnection connection(Collection<InetSocketAddress> srvs) throws GridClientException, InterruptedException
Returns connection to node using given server addresses.- Parameters:
srvs- Server addresses.- Returns:
- Established connection.
- Throws:
GridClientException- If failed.InterruptedException- If was interrupted while waiting for connection to be established.
-
-