Class ResponseCollector<T>

java.lang.Object
org.jgroups.util.ResponseCollector<T>

public class ResponseCollector<T> extends Object
Similar to AckCollector, but collects responses, not just acks. Null is not a valid key.
Version:
$Id: ResponseCollector.java,v 1.1.2.5 2009/04/21 10:09:22 belaban Exp $
Author:
Bela Ban
  • Constructor Details

    • ResponseCollector

      public ResponseCollector(Collection<Address> members)
      Parameters:
      members - List of members from which we expect responses
    • ResponseCollector

      public ResponseCollector()
  • Method Details

    • add

      public void add(Address member, T data)
    • remove

      public void remove(Address member)
    • suspect

      public void suspect(Address member)
    • hasAllResponses

      public boolean hasAllResponses()
    • getResults

      public Map<Address,T> getResults()
    • 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(Collection<Address> members)
    • toString

      public String toString()
      Overrides:
      toString in class Object