DefaultConnectionPolicy, FixedNodeConnectionPolicypublic abstract class ConnectionPolicy
extends java.lang.Object
ConnectionFactory| Constructor | Description |
|---|---|
ConnectionPolicy(PeerNode remoteNode) |
Creates a connection policy with one available node to connect to.
|
ConnectionPolicy(java.util.List<PeerNode> availableRemoteNodes) |
Creates a connection policy with the given set of nodes available for
connections.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
availableNodeAdded(PeerNode newNode) |
Signals the connection policy that the given node has been added to the
list of available nodes.
|
void |
availableNodeRemoved(PeerNode removedNode) |
Signals the connection policy that the given node has been removed from
the list of available nodes.
|
void |
availableNodesReset() |
Signals the connection policy that the list of available nodes has been
reset (cleared).
|
void |
nodeConnectSuccess(PeerNode node) |
Acts upon a successful connect attempt of the given node.
|
void |
nodeFailed(PeerNode node) |
Acts upon a failure of the given node.
|
void |
nodeFailReset(PeerNode node) |
Acts upon a failure reset of the given node.
|
PeerNode |
selectNode() |
Selects the node to connect with when establishing a connection (no
failed node, no exception that has already been thrown).
|
abstract <E extends java.lang.Exception> |
selectNode(int retry,
PeerNode failedNode,
E e) |
Selects the node to (re-)connect with.
|
public ConnectionPolicy(PeerNode remoteNode)
remoteNode - the node available for connectionspublic ConnectionPolicy(java.util.List<PeerNode> availableRemoteNodes)
availableRemoteNodes - available nodes to connect topublic void availableNodeAdded(PeerNode newNode)
newNode - the new nodepublic void availableNodeRemoved(PeerNode removedNode)
removedNode - the removed nodepublic void availableNodesReset()
public void nodeFailed(PeerNode node)
node - the failed nodepublic void nodeFailReset(PeerNode node)
node - the nodepublic void nodeConnectSuccess(PeerNode node)
node - the nodepublic PeerNode selectNode() throws java.lang.UnsupportedOperationException
java.lang.UnsupportedOperationException - is thrown if the operation can not be performed, e.g. the
list is emptyConnectionFactorypublic abstract <E extends java.lang.Exception> PeerNode selectNode(int retry, PeerNode failedNode, E e) throws E extends java.lang.Exception, java.lang.UnsupportedOperationException
E - the type of the exception that came from the failed connection
and may be re-thrownretry - the n'th retry (initial connect = 0, 1st reconnect = 1,...)failedNode - the node from the previous connection attempt or nulle - the exception that came back from the previous connection
attempt or nullE - if thrown, automatic re-connection attempts will stopjava.lang.UnsupportedOperationException - is thrown if the operation can not be performed, e.g. the
list is emptyE extends java.lang.ExceptionConnection.connect(),
Connection.doRPC(String, String,
com.ericsson.otp.erlang.OtpErlangList),
Connection.doRPC(String, String,
com.ericsson.otp.erlang.OtpErlangObject[])