public abstract class ConnectionPolicy extends Object
ConnectionFactory| Constructor and Description |
|---|
ConnectionPolicy(List<PeerNode> availableRemoteNodes)
Creates a connection policy with the given set of nodes available for
connections.
|
ConnectionPolicy(PeerNode remoteNode)
Creates a connection policy with one available node to connect to.
|
| Modifier and Type | Method and 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 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 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 UnsupportedOperationException
UnsupportedOperationException - is thrown if the operation can not be performed, e.g. the
list is emptyConnectionFactorypublic abstract <E extends Exception> PeerNode selectNode(int retry, PeerNode failedNode, E e) throws E extends Exception, 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 stopUnsupportedOperationException - is thrown if the operation can not be performed, e.g. the
list is emptyE extends ExceptionConnection.connect(),
Connection.doRPC(String, String,
com.ericsson.otp.erlang.OtpErlangList),
Connection.doRPC(String, String,
com.ericsson.otp.erlang.OtpErlangObject[])