Package net.spy.memcached.ops
Class MultiOperationCallback
- java.lang.Object
-
- net.spy.memcached.ops.MultiOperationCallback
-
- All Implemented Interfaces:
OperationCallback
- Direct Known Subclasses:
MultiGetOperationCallback,MultiGetsOperationCallback,MultiReplicaGetOperationCallback
public abstract class MultiOperationCallback extends java.lang.Object implements OperationCallback
An operation callback that will capture receivedStatus and complete invocations and dispatch to a single callback.This is useful for the cases where a single request gets split into multiple requests and the callback needs to not know the difference.
-
-
Field Summary
Fields Modifier and Type Field Description private OperationStatusmostRecentStatusprotected OperationCallbackoriginalCallbackprivate java.util.concurrent.atomic.AtomicIntegerremaining
-
Constructor Summary
Constructors Constructor Description MultiOperationCallback(OperationCallback original, int todo)Get a MultiOperationCallback over the given callback for the specified number of replicates.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcomplete()Called whenever an operation completes.voidreceivedStatus(OperationStatus status)Method invoked with the status when the operation is complete.
-
-
-
Field Detail
-
mostRecentStatus
private OperationStatus mostRecentStatus
-
remaining
private final java.util.concurrent.atomic.AtomicInteger remaining
-
originalCallback
protected final OperationCallback originalCallback
-
-
Constructor Detail
-
MultiOperationCallback
public MultiOperationCallback(OperationCallback original, int todo)
Get a MultiOperationCallback over the given callback for the specified number of replicates.- Parameters:
original- the original callbacktodo- how many complete() calls we expect before dispatching.
-
-
Method Detail
-
complete
public void complete()
Description copied from interface:OperationCallbackCalled whenever an operation completes.- Specified by:
completein interfaceOperationCallback
-
receivedStatus
public void receivedStatus(OperationStatus status)
Description copied from interface:OperationCallbackMethod invoked with the status when the operation is complete.- Specified by:
receivedStatusin interfaceOperationCallback- Parameters:
status- the result of the operation
-
-