net.spy.memcached
Class TapConnectionProvider

java.lang.Object
  extended by net.spy.memcached.compat.SpyObject
      extended by net.spy.memcached.TapConnectionProvider
All Implemented Interfaces:
ConnectionObserver

public class TapConnectionProvider
extends SpyObject
implements ConnectionObserver

A TapConnectionProvider.


Field Summary
protected  AuthDescriptor authDescriptor
           
protected  AuthThreadMonitor authMonitor
           
protected  MemcachedConnection conn
           
protected  OperationFactory opFact
           
protected  boolean shuttingDown
           
protected  TranscodeService tcService
           
 
Constructor Summary
TapConnectionProvider(ConnectionFactory cf, java.util.List<java.net.InetSocketAddress> addrs)
          Get a tap client operating on the specified memcached locations.
TapConnectionProvider(java.net.InetSocketAddress... ia)
          Get a tap client operating on the specified memcached locations.
TapConnectionProvider(java.util.List<java.net.InetSocketAddress> addrs)
          Get a tap client operating on the specified memcached locations.
 
Method Summary
 boolean addObserver(ConnectionObserver obs)
          Add a connection observer.
 void addTapAckOp(MemcachedNode node, Operation op)
           
 java.util.concurrent.CountDownLatch broadcastOp(BroadcastOpFactory of)
           
 void connectionEstablished(java.net.SocketAddress sa, int reconnectCount)
          A connection has just successfully been established on the given socket.
 void connectionLost(java.net.SocketAddress sa)
          A connection was just lost on the given socket.
 OperationFactory getOpFactory()
           
 boolean removeObserver(ConnectionObserver obs)
          Remove a connection observer.
 void shutdown()
          Shut down immediately.
 boolean shutdown(long timeout, java.util.concurrent.TimeUnit unit)
          Shut down this client gracefully.
 boolean waitForQueues(long timeout, java.util.concurrent.TimeUnit unit)
          Wait for the queues to die down.
 
Methods inherited from class net.spy.memcached.compat.SpyObject
getLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

shuttingDown

protected volatile boolean shuttingDown

conn

protected final MemcachedConnection conn

opFact

protected final OperationFactory opFact

tcService

protected final TranscodeService tcService

authDescriptor

protected final AuthDescriptor authDescriptor

authMonitor

protected final AuthThreadMonitor authMonitor
Constructor Detail

TapConnectionProvider

public TapConnectionProvider(java.net.InetSocketAddress... ia)
                      throws java.io.IOException
Get a tap client operating on the specified memcached locations.

Parameters:
ia - the memcached locations
Throws:
java.io.IOException - if connections cannot be established

TapConnectionProvider

public TapConnectionProvider(java.util.List<java.net.InetSocketAddress> addrs)
                      throws java.io.IOException
Get a tap client operating on the specified memcached locations.

Parameters:
addrs - the socket addrs
Throws:
java.io.IOException - if connections cannot be established

TapConnectionProvider

public TapConnectionProvider(ConnectionFactory cf,
                             java.util.List<java.net.InetSocketAddress> addrs)
                      throws java.io.IOException
Get a tap client operating on the specified memcached locations.

Parameters:
cf - the connection factory to configure connections for this client
addrs - the socket addresses
Throws:
java.io.IOException - if connections cannot be established
Method Detail

addTapAckOp

public void addTapAckOp(MemcachedNode node,
                        Operation op)

broadcastOp

public java.util.concurrent.CountDownLatch broadcastOp(BroadcastOpFactory of)

addObserver

public boolean addObserver(ConnectionObserver obs)
Add a connection observer. If connections are already established, your observer will be called with the address and -1.

Parameters:
obs - the ConnectionObserver you wish to add
Returns:
true if the observer was added.

removeObserver

public boolean removeObserver(ConnectionObserver obs)
Remove a connection observer.

Parameters:
obs - the ConnectionObserver you wish to add
Returns:
true if the observer existed, but no longer does

connectionEstablished

public void connectionEstablished(java.net.SocketAddress sa,
                                  int reconnectCount)
Description copied from interface: ConnectionObserver
A connection has just successfully been established on the given socket.

Specified by:
connectionEstablished in interface ConnectionObserver
Parameters:
sa - the address of the node whose connection was established
reconnectCount - the number of attempts before the connection was established

connectionLost

public void connectionLost(java.net.SocketAddress sa)
Description copied from interface: ConnectionObserver
A connection was just lost on the given socket.

Specified by:
connectionLost in interface ConnectionObserver
Parameters:
sa - the address of the node whose connection was lost

shutdown

public void shutdown()
Shut down immediately.


shutdown

public boolean shutdown(long timeout,
                        java.util.concurrent.TimeUnit unit)
Shut down this client gracefully.

Parameters:
timeout - the amount of time for shutdown
unit - the TimeUnit for the timeout
Returns:
result of the shutdown request

waitForQueues

public boolean waitForQueues(long timeout,
                             java.util.concurrent.TimeUnit unit)
Wait for the queues to die down.

Parameters:
timeout - the amount of time time for shutdown
unit - the TimeUnit for the timeout
Returns:
result of the request for the wait
Throws:
java.lang.IllegalStateException - in the rare circumstance where queue is too full to accept any more requests

getOpFactory

public OperationFactory getOpFactory()


Copyright © 2006-2009 Dustin Sallings, 2009-2012 Couchbase, Inc.