org.objectweb.tribe.adapters
Interface MulticastRequestListener


public interface MulticastRequestListener

This class defines a MulticastRequestListener to handle calls from a MulticastRequestAdapter. When MulticastRequestAdapter.multicastMessage(...) is called, the remote node must reply (possibly with a null message). The message handling is split in 2 callbacks:

1. call to handleMessageSingleThreaded(...). This is done in mutual exclusion and no other message can be delivered until this function has returned. An object can be returned to pass temporary data to the second handler.

2. handleMessageMultiThreaded is executed in a dedicated thread and return the result of the call in a Serializable object.

Note that any of these handlers might be empty and just return null.

Version:
1.0
Author:
Emmanuel Cecchet

Method Summary
 java.io.Serializable handleMessageMultiThreaded(java.io.Serializable msg, Member sender, java.lang.Object handleMessageSingleThreadedResult)
          Second callback to handle a message sent through MulticastRequestAdapter.multicastMessage(...).
 java.lang.Object handleMessageSingleThreaded(java.io.Serializable msg, Member sender)
          First callback to handle a message sent through MulticastRequestAdapter.multicastMessage(...).
 

Method Detail

handleMessageSingleThreaded

public java.lang.Object handleMessageSingleThreaded(java.io.Serializable msg,
                                                    Member sender)
First callback to handle a message sent through MulticastRequestAdapter.multicastMessage(...). This method is executed in mutual exclusion and block subsequent message deliveries until this callback returns. The object returned by this function is used to pass temporary data to the second callback.

Parameters:
msg - the message received that needs to be handled
sender - the message sender
Returns:
the object to pass to handleMessageMultiThreaded
See Also:
MulticastRequestAdapter.multicastMessage(ArrayList, Serializable, int, long), handleMessageMultiThreaded(Serializable, Member, Object)

handleMessageMultiThreaded

public java.io.Serializable handleMessageMultiThreaded(java.io.Serializable msg,
                                                       Member sender,
                                                       java.lang.Object handleMessageSingleThreadedResult)
Second callback to handle a message sent through MulticastRequestAdapter.multicastMessage(...). The code of this callback will execute in a dedicated thread and therefore will execute concurrently of other messages processing.

Parameters:
msg - the message received that needs to be handled
sender - the message sender
handleMessageSingleThreadedResult - result of the first callback (may be null)
Returns:
the reply to send back
See Also:
MulticastRequestAdapter.multicastMessage(ArrayList, Serializable, int, long)


Copyright © 2004 - ObjectWeb Consortium - All Rights Reserved.