com.netflix.astyanax.connectionpool
Interface Connection<CL>

Type Parameters:
CL -
All Superinterfaces:
ConnectionContext

public interface Connection<CL>
extends ConnectionContext

Interface to an instance of a connection on a host.


Nested Class Summary
static interface Connection.AsyncOpenCallback<CL>
           
 
Method Summary
 void close()
          Shut down the connection.
<R> OperationResult<R>
execute(Operation<CL,R> op)
          Execute an operation on the connection and return a result
 Host getHost()
           
 HostConnectionPool<CL> getHostConnectionPool()
           
 ConnectionException getLastException()
           
 long getOperationCount()
           
 void open()
          Open a new connection
 void openAsync(Connection.AsyncOpenCallback<CL> callback)
          Open a connection asynchronously and call the callback on connection or failure
 
Methods inherited from interface com.netflix.astyanax.connectionpool.ConnectionContext
getMetadata, hasMetadata, setMetadata
 

Method Detail

execute

<R> OperationResult<R> execute(Operation<CL,R> op)
                           throws ConnectionException
Execute an operation on the connection and return a result

Type Parameters:
R -
Parameters:
op -
Throws:
ConnectionException

close

void close()
Shut down the connection. isOpen() will now return false.


getHostConnectionPool

HostConnectionPool<CL> getHostConnectionPool()
Returns:
Get the parent host connection pool.

getHost

Host getHost()
Returns:
Get the host for this connection

getLastException

ConnectionException getLastException()
Returns:
Get the last exception that caused the connection to be closed

open

void open()
          throws ConnectionException
Open a new connection

Throws:
ConnectionException

openAsync

void openAsync(Connection.AsyncOpenCallback<CL> callback)
Open a connection asynchronously and call the callback on connection or failure

Parameters:
callback -

getOperationCount

long getOperationCount()
Returns:
Number of operations performed on this connections since it was opened