de.zib.scalaris
Class FixedNodeConnectionPolicy

java.lang.Object
  extended by de.zib.scalaris.ConnectionPolicy
      extended by de.zib.scalaris.FixedNodeConnectionPolicy

public class FixedNodeConnectionPolicy
extends ConnectionPolicy

Implements a ConnectionPolicy which only supports a single node and does not issue automatic re-tries.

Since:
3.10
Version:
3.10
Author:
Nico Kruber, kruber@zib.de
See Also:
DefaultConnectionPolicy

Constructor Summary
FixedNodeConnectionPolicy(PeerNode remoteNode)
          Creates a new connection policy working with the given remote node.
FixedNodeConnectionPolicy(String remoteNode)
          Creates a new connection policy working with the given remote node.
 
Method Summary
<E extends Exception>
PeerNode
selectNode(int retry, PeerNode failedNode, E e)
          Selects the node to (re-)connect with.
 
Methods inherited from class de.zib.scalaris.ConnectionPolicy
availableNodeAdded, availableNodeRemoved, availableNodesReset, nodeConnectSuccess, nodeFailed, nodeFailReset, selectNode
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FixedNodeConnectionPolicy

public FixedNodeConnectionPolicy(PeerNode remoteNode)
Creates a new connection policy working with the given remote node.

Parameters:
remoteNode - the (only) available remote node

FixedNodeConnectionPolicy

public FixedNodeConnectionPolicy(String remoteNode)
Creates a new connection policy working with the given remote node.

Parameters:
remoteNode - the (only) available remote node
Method Detail

selectNode

public <E extends Exception> PeerNode selectNode(int retry,
                                                 PeerNode failedNode,
                                                 E e)
                    throws E extends Exception,
                           UnsupportedOperationException
Description copied from class: ConnectionPolicy
Selects the node to (re-)connect with. If no re-connection is desired, throw an exception!

Specified by:
selectNode in class ConnectionPolicy
Type Parameters:
E - the type of the exception that came from the failed connection and may be re-thrown
Parameters:
retry - the n'th retry (initial connect = 0, 1st reconnect = 1,...)
failedNode - the node from the previous connection attempt or null
e - the exception that came back from the previous connection attempt or null
Returns:
the new node to connect with
Throws:
E - if thrown, automatic re-connection attempts will stop
UnsupportedOperationException - is thrown if the operation can not be performed, e.g. the list is empty
E extends Exception
See Also:
Connection.connect(), Connection.doRPC(String, String, com.ericsson.otp.erlang.OtpErlangList), Connection.doRPC(String, String, com.ericsson.otp.erlang.OtpErlangObject[])