com.netflix.astyanax.test
Class TestConnectionPool

java.lang.Object
  extended by com.netflix.astyanax.test.TestConnectionPool
All Implemented Interfaces:
ConnectionPool<TestClient>

public class TestConnectionPool
extends java.lang.Object
implements ConnectionPool<TestClient>


Constructor Summary
TestConnectionPool()
           
 
Method Summary
 boolean addHost(Host host, boolean refresh)
          Add a host to the connection pool.
<R> OperationResult<R>
executeWithFailover(Operation<TestClient,R> op, RetryPolicy retry)
          Execute an operation with failover within the context of the connection pool.
 java.util.List<HostConnectionPool<TestClient>> getActivePools()
           
 HostConnectionPool<TestClient> getHostPool(Host host)
           
 java.util.Collection<Host> getHosts()
           
 Partitioner getPartitioner()
           
 java.util.List<HostConnectionPool<TestClient>> getPools()
           
 Topology<TestClient> getTopology()
           
 boolean hasHost(Host host)
           
 boolean isHostUp(Host host)
           
 boolean removeHost(Host host, boolean refresh)
          Remove a host from the connection pool.
 void setHosts(java.util.Collection<Host> ring)
          Set the complete set of hosts in the ring
 void shutdown()
          Shut down the connection pool and terminate all existing connections
 void start()
          Setup the connection pool and start any maintenance threads
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestConnectionPool

public TestConnectionPool()
Method Detail

getHosts

public java.util.Collection<Host> getHosts()

addHost

public boolean addHost(Host host,
                       boolean refresh)
Description copied from interface: ConnectionPool
Add a host to the connection pool.

Specified by:
addHost in interface ConnectionPool<TestClient>

removeHost

public boolean removeHost(Host host,
                          boolean refresh)
Description copied from interface: ConnectionPool
Remove a host from the connection pool. Any pending connections will be allowed to complete

Specified by:
removeHost in interface ConnectionPool<TestClient>

setHosts

public void setHosts(java.util.Collection<Host> ring)
Description copied from interface: ConnectionPool
Set the complete set of hosts in the ring

Specified by:
setHosts in interface ConnectionPool<TestClient>

executeWithFailover

public <R> OperationResult<R> executeWithFailover(Operation<TestClient,R> op,
                                                  RetryPolicy retry)
                                       throws ConnectionException,
                                              OperationException
Description copied from interface: ConnectionPool
Execute an operation with failover within the context of the connection pool. The operation will only fail over for connection pool errors and not application errors.

Specified by:
executeWithFailover in interface ConnectionPool<TestClient>
Throws:
ConnectionException
OperationException

shutdown

public void shutdown()
Description copied from interface: ConnectionPool
Shut down the connection pool and terminate all existing connections

Specified by:
shutdown in interface ConnectionPool<TestClient>

start

public void start()
Description copied from interface: ConnectionPool
Setup the connection pool and start any maintenance threads

Specified by:
start in interface ConnectionPool<TestClient>

isHostUp

public boolean isHostUp(Host host)
Specified by:
isHostUp in interface ConnectionPool<TestClient>
Returns:
Return true if the host is up

hasHost

public boolean hasHost(Host host)
Specified by:
hasHost in interface ConnectionPool<TestClient>
Returns:
Return true if host is contained within the connection pool

getHostPool

public HostConnectionPool<TestClient> getHostPool(Host host)
Specified by:
getHostPool in interface ConnectionPool<TestClient>
Returns:
Return an immutable connection pool for this host

getActivePools

public java.util.List<HostConnectionPool<TestClient>> getActivePools()
Specified by:
getActivePools in interface ConnectionPool<TestClient>
Returns:
Return list of active hosts on which connections can be created

getPools

public java.util.List<HostConnectionPool<TestClient>> getPools()
Specified by:
getPools in interface ConnectionPool<TestClient>
Returns:
Get all pools

getTopology

public Topology<TestClient> getTopology()
Specified by:
getTopology in interface ConnectionPool<TestClient>
Returns:
Return the internal topology which represents the partitioning of data across hosts in the pool

getPartitioner

public Partitioner getPartitioner()
Specified by:
getPartitioner in interface ConnectionPool<TestClient>
Returns:
Return the partitioner used by this pool.