Class TapConnectionProvider

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

public class TapConnectionProvider extends SpyObject implements ConnectionObserver
A TapConnectionProvider.
  • Field Details

  • Constructor Details

    • TapConnectionProvider

      public TapConnectionProvider(InetSocketAddress... ia) throws IOException
      Get a tap client operating on the specified memcached locations.
      Parameters:
      ia - the memcached locations
      Throws:
      IOException - if connections cannot be established
    • TapConnectionProvider

      public TapConnectionProvider(List<InetSocketAddress> addrs) throws IOException
      Get a tap client operating on the specified memcached locations.
      Parameters:
      addrs - the socket addrs
      Throws:
      IOException - if connections cannot be established
    • TapConnectionProvider

      public TapConnectionProvider(ConnectionFactory cf, List<InetSocketAddress> addrs) throws 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:
      IOException - if connections cannot be established
  • Method Details

    • addTapAckOp

      public void addTapAckOp(MemcachedNode node, Operation op)
    • broadcastOp

      public 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(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
    • findNode

      private MemcachedNode findNode(SocketAddress sa)
    • connectionLost

      public void connectionLost(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, 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, 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:
      IllegalStateException - in the rare circumstance where queue is too full to accept any more requests
    • broadcastOp

      private CountDownLatch broadcastOp(BroadcastOpFactory of, Collection<MemcachedNode> nodes, boolean checkShuttingDown)
    • getOpFactory

      public OperationFactory getOpFactory()