Class 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 Detail

      • ResponseCollector

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

        public ResponseCollector​(Address... members)
      • ResponseCollector

        public ResponseCollector()
    • Method Detail

      • add

        public boolean add​(Address member,
                           T data)
      • 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()
      • getResults

        public java.util.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​(java.util.Collection<Address> members)
      • reset

        public void reset​(Address... members)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object