org.objectweb.tribe.adapters
Class MulticastResponse

java.lang.Object
  extended byorg.objectweb.tribe.adapters.MulticastResponse

public class MulticastResponse
extends java.lang.Object

This class defines a MulticastResponse

Version:
1.0
Author:
Emmanuel Cecchet

Constructor Summary
MulticastResponse(java.util.ArrayList recipient, int waitMode)
          Creates a new MulticastResponse object
 
Method Summary
 void addResult(Member m, java.io.Serializable result)
          Add the given result for the specified member.
 java.util.ArrayList getFailedMembers()
          Returns the list of failed Members.
 java.util.ArrayList getRecipient()
          Returns the original list of the recipients (the ones we sent the message to).
 java.io.Serializable getResult(Member m)
          Get the result returned by the specified member.
 java.util.HashMap getResults()
          Returns the member results (for all Members that succeeded).
 java.util.ArrayList getSucceedMembers()
          Returns the list of members who sucessfully returned a response.
 void setFailedMembers(java.util.ArrayList failedMembers)
          Sets the list of failed Members.
 void waitForCompletion(long timeout)
          Wait until the needed number of responses has been received (according to the waiting mode policy).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MulticastResponse

public MulticastResponse(java.util.ArrayList recipient,
                         int waitMode)
Creates a new MulticastResponse object

Parameters:
recipient - ArrayList of Member to which the request is sent
waitMode - one of MulticastRequestAdapter.WAIT_NONE, WAIT_FIRST, WAIT_MAJORITY or WAIT_ALL
Method Detail

getFailedMembers

public java.util.ArrayList getFailedMembers()
Returns the list of failed Members.

Returns:
Returns the failed Members.

setFailedMembers

public void setFailedMembers(java.util.ArrayList failedMembers)
Sets the list of failed Members. If the list of failed members is not null then we check if the wait mode policy has been satisfied and unblock waitForCompletion if needed.

Parameters:
failedMembers - The failed Members to set.

getResults

public java.util.HashMap getResults()
Returns the member results (for all Members that succeeded). The Hashmap uses the Member as a key and the result as a value.

Returns:
Returns the member results.

getResult

public java.io.Serializable getResult(Member m)
Get the result returned by the specified member.

Parameters:
m - the member for which we need the result
Returns:
the result or null if no result has been found (member failure or member not part of this request).

addResult

public void addResult(Member m,
                      java.io.Serializable result)
Add the given result for the specified member.

The member is then added in the succeedMembers list and the waitForCompletion() method might be unblocked according to the waiting mode policy specified in the constructor.

Parameters:
m - member sending this result
result - result to add.

getSucceedMembers

public java.util.ArrayList getSucceedMembers()
Returns the list of members who sucessfully returned a response.

Returns:
Returns the succeed Members.
See Also:
addResult(Member, Serializable)

getRecipient

public java.util.ArrayList getRecipient()
Returns the original list of the recipients (the ones we sent the message to).

Returns:
Returns an ArrayList of Member.

waitForCompletion

public void waitForCompletion(long timeout)
                       throws TimeoutException
Wait until the needed number of responses has been received (according to the waiting mode policy).

Parameters:
timeout - maximum time in ms to wait for (0 means no timeout)
Throws:
TimeoutException


Copyright © 2004 - ObjectWeb Consortium - All Rights Reserved.