net.spy.memcached.ops
Class MultiOperationCallback

java.lang.Object
  extended by net.spy.memcached.ops.MultiOperationCallback
All Implemented Interfaces:
OperationCallback
Direct Known Subclasses:
MultiGetOperationCallback, MultiGetsOperationCallback

public abstract class MultiOperationCallback
extends 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
protected  OperationCallback originalCallback
           
 
Constructor Summary
MultiOperationCallback(OperationCallback original, int todo)
          Get a MultiOperationCallback over the given callback for the specified number of replicates.
 
Method Summary
 void complete()
          Called whenever an operation completes.
 void receivedStatus(OperationStatus status)
          Method invoked with the status when the operation is complete.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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 callback
todo - how many complete() calls we expect before dispatching.
Method Detail

complete

public void complete()
Description copied from interface: OperationCallback
Called whenever an operation completes.

Specified by:
complete in interface OperationCallback

receivedStatus

public void receivedStatus(OperationStatus status)
Description copied from interface: OperationCallback
Method invoked with the status when the operation is complete.

Specified by:
receivedStatus in interface OperationCallback
Parameters:
status - the result of the operation