Class TapConnectionProvider

    • 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

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

        private MemcachedNode findNode​(java.net.SocketAddress sa)
      • 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
      • broadcastOp

        private java.util.concurrent.CountDownLatch broadcastOp​(BroadcastOpFactory of,
                                                                java.util.Collection<MemcachedNode> nodes,
                                                                boolean checkShuttingDown)