Package net.spy.memcached
Class TapConnectionProvider
java.lang.Object
net.spy.memcached.compat.SpyObject
net.spy.memcached.TapConnectionProvider
- All Implemented Interfaces:
ConnectionObserver
A TapConnectionProvider.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final AuthDescriptor
protected final AuthThreadMonitor
protected final MemcachedConnection
protected final OperationFactory
protected boolean
protected final TranscodeService
-
Constructor Summary
ConstructorsConstructorDescriptionGet a tap client operating on the specified memcached locations.Get a tap client operating on the specified memcached locations.TapConnectionProvider
(ConnectionFactory cf, List<InetSocketAddress> addrs) Get a tap client operating on the specified memcached locations. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Add a connection observer.void
addTapAckOp
(MemcachedNode node, Operation op) private CountDownLatch
broadcastOp
(BroadcastOpFactory of, Collection<MemcachedNode> nodes, boolean checkShuttingDown) void
connectionEstablished
(SocketAddress sa, int reconnectCount) A connection has just successfully been established on the given socket.void
A connection was just lost on the given socket.private MemcachedNode
boolean
Remove a connection observer.void
shutdown()
Shut down immediately.boolean
Shut down this client gracefully.boolean
waitForQueues
(long timeout, TimeUnit unit) Wait for the queues to die down.
-
Field Details
-
shuttingDown
protected volatile boolean shuttingDown -
conn
-
opFact
-
tcService
-
authDescriptor
-
authMonitor
-
-
Constructor Details
-
TapConnectionProvider
Get a tap client operating on the specified memcached locations.- Parameters:
ia
- the memcached locations- Throws:
IOException
- if connections cannot be established
-
TapConnectionProvider
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 clientaddrs
- the socket addresses- Throws:
IOException
- if connections cannot be established
-
-
Method Details
-
addTapAckOp
-
broadcastOp
-
addObserver
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
Remove a connection observer.- Parameters:
obs
- the ConnectionObserver you wish to add- Returns:
- true if the observer existed, but no longer does
-
connectionEstablished
Description copied from interface:ConnectionObserver
A connection has just successfully been established on the given socket.- Specified by:
connectionEstablished
in interfaceConnectionObserver
- Parameters:
sa
- the address of the node whose connection was establishedreconnectCount
- the number of attempts before the connection was established
-
findNode
-
connectionLost
Description copied from interface:ConnectionObserver
A connection was just lost on the given socket.- Specified by:
connectionLost
in interfaceConnectionObserver
- Parameters:
sa
- the address of the node whose connection was lost
-
shutdown
public void shutdown()Shut down immediately. -
shutdown
Shut down this client gracefully.- Parameters:
timeout
- the amount of time for shutdownunit
- the TimeUnit for the timeout- Returns:
- result of the shutdown request
-
waitForQueues
Wait for the queues to die down.- Parameters:
timeout
- the amount of time time for shutdownunit
- 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
-