Package org.jgroups.util
Class ResponseCollector<T>
- java.lang.Object
-
- org.jgroups.util.ResponseCollector<T>
-
- Direct Known Subclasses:
ResponseCollectorTask
public class ResponseCollector<T> extends java.lang.Object
Similar to AckCollector, but collects responses from cluster members, not just acks. Null is not a valid key.- Author:
- Bela Ban
-
-
Constructor Summary
Constructors Constructor Description ResponseCollector()
ResponseCollector(java.util.Collection<Address> members)
ResponseCollector(Address... members)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(Address member, T data)
java.util.List<Address>
getMissing()
Returns a list of members which didn't send a valid responsejava.util.Map<Address,T>
getResults()
java.util.List<Address>
getValidResults()
boolean
hasAllResponses()
int
numberOfValidResponses()
void
remove(java.util.List<Address> members)
void
remove(Address member)
void
reset()
void
reset(java.util.Collection<Address> members)
void
reset(Address... members)
boolean
retainAll(java.util.List<Address> members)
int
size()
void
suspect(Address member)
java.lang.String
toString()
boolean
waitForAllResponses(long timeout)
Waits until all responses have been received, or until a timeout has elapsed.
-
-
-
Method Detail
-
remove
public void remove(Address member)
-
remove
public void remove(java.util.List<Address> members)
-
retainAll
public boolean retainAll(java.util.List<Address> members)
-
suspect
public void suspect(Address member)
-
hasAllResponses
public boolean hasAllResponses()
-
numberOfValidResponses
public int numberOfValidResponses()
-
getMissing
public java.util.List<Address> getMissing()
Returns a list of members which didn't send a valid response
-
getValidResults
public java.util.List<Address> getValidResults()
-
size
public int size()
-
waitForAllResponses
public boolean waitForAllResponses(long timeout)
Waits until all responses have been received, or until a timeout has elapsed.- Parameters:
timeout
- Number of milliseconds to wait max. This value needs to be greater than 0, or else it will be adjusted to 2000- Returns:
- boolean True if all responses have been received within timeout ms, else false (e.g. if interrupted)
-
reset
public void reset()
-
reset
public void reset(java.util.Collection<Address> members)
-
reset
public void reset(Address... members)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-