com.netflix.astyanax.connectionpool.impl
Class RoundRobinExecuteWithFailover<CL,R>
java.lang.Object
com.netflix.astyanax.connectionpool.impl.AbstractExecuteWithFailoverImpl<CL,R>
com.netflix.astyanax.connectionpool.impl.RoundRobinExecuteWithFailover<CL,R>
- Type Parameters:
CL - R -
- All Implemented Interfaces:
- ExecuteWithFailover<CL,R>
public class RoundRobinExecuteWithFailover<CL,R>
- extends AbstractExecuteWithFailoverImpl<CL,R>
Class that extends AbstractExecuteWithFailoverImpl to provide functionality for borrowing a Connection from a list of HostConnectionPool(s)
in a round robin fashion.
It maintains state of the current and next pool to be used by a revolving index over the list of pools, hence round robin.
It also maintains state of how many retries have been done for this instance and consults the
ConnectionPoolConfiguration.getMaxFailoverCount() threshold.
- See Also:
AbstractExecuteWithFailoverImpl} for details on how failover is repeatedly called for ensuring that an {@link Operation} can be executed with resiliency.,
RoundRobinConnectionPoolImpl} for the impl that references this class.,
AbstractHostPartitionConnectionPool} for more context on how failover functionality is used within the context of an operation execution
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
pool
protected HostConnectionPool<CL> pool
pools
protected final java.util.List<HostConnectionPool<CL>> pools
size
protected final int size
waitDelta
protected int waitDelta
waitMultiplier
protected int waitMultiplier
RoundRobinExecuteWithFailover
public RoundRobinExecuteWithFailover(ConnectionPoolConfiguration config,
ConnectionPoolMonitor monitor,
java.util.List<HostConnectionPool<CL>> pools,
int index)
throws ConnectionException
- Throws:
ConnectionException
getNextHostIndex
public int getNextHostIndex()
canRetry
public boolean canRetry()
- Specified by:
canRetry in class AbstractExecuteWithFailoverImpl<CL,R>
- Returns:
- boolean
getCurrentHostConnectionPool
public HostConnectionPool<CL> getCurrentHostConnectionPool()
- Specified by:
getCurrentHostConnectionPool in class AbstractExecuteWithFailoverImpl<CL,R>
- Returns:
HostConnectionPool
borrowConnection
public Connection<CL> borrowConnection(Operation<CL,R> operation)
throws ConnectionException
- Specified by:
borrowConnection in class AbstractExecuteWithFailoverImpl<CL,R>
- Returns:
Connection
- Throws:
ConnectionException