mandala.rami.impl
Class CallbackList

java.lang.Object
  extended bymandala.rami.impl.CallbackList
All Implemented Interfaces:
Callback, java.io.Serializable

public class CallbackList
extends java.lang.Object
implements Callback, java.io.Serializable

Provides a list of Callback seen as a unique Callback.

The order callbacks are invoked is the FIFO order.

If a callback in the list is null it is not used.

CallbackList usage:
Since only one callback is used on asynchronous method invocation termination as specified in the AsynchronousReference interface, this callback list is encourage to be used when specifying a local method scope callback such as in the following code:

ar.call(m, args, new CallbackList(new Callback[]{new Callback() { 
    public void done(InvocationInfo i, MethodResult r) {
        System.out.println(i.getMethod() + " terminated!");
    }},
    ar.getCallbackManager().getLocalCallback(),
    ar.getCallbackManager().getGlobalManager()}));

In the above code, the customized callback will be used, followed by the local thread scope one (if non null), and the global object scope one (if non null).

Version:
1.0
Author:
eipi
See Also:
Callback, AsynchronousReference, CallbackManager, Serialized Form

Field Summary
protected  java.util.List list
          The callbacks list.
 
Constructor Summary
CallbackList()
          Creates a new CallbackList instance with no callback in it.
CallbackList(Callback[] list)
          Creates a new CallbackList instance.
CallbackList(java.util.List list)
          Creates a new CallbackList instance.
 
Method Summary
 void addCallback(Callback callback)
           
 void done(InvocationInfo invocationInfo, MethodResult methodResult)
          This method is called once an asynchronous method invocation had been considered terminated.
 Callback[] getList()
           
 void remove(Callback callback)
           
 void setList(Callback[] list)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

list

protected java.util.List list

The callbacks list.

Constructor Detail

CallbackList

public CallbackList()

Creates a new CallbackList instance with no callback in it.


CallbackList

public CallbackList(Callback[] list)

Creates a new CallbackList instance.

null callback in the given list is valid.

Parameters:
list - a Callback[] value

CallbackList

public CallbackList(java.util.List list)

Creates a new CallbackList instance.

Parameters:
list - a List value
Method Detail

done

public void done(InvocationInfo invocationInfo,
                 MethodResult methodResult)
Description copied from interface: Callback

This method is called once an asynchronous method invocation had been considered terminated.

Specified by:
done in interface Callback
Parameters:
invocationInfo - the invocationInfo object representing informations on the asychronous method invocation.
methodResult - the MethodResult object representing the result of the asychronous method invocation.
See Also:
InvocationInfo, MethodResult

addCallback

public void addCallback(Callback callback)

remove

public void remove(Callback callback)

getList

public Callback[] getList()

setList

public void setList(Callback[] list)

toString

public java.lang.String toString()


Mandala help mailing list