org.jgroups.util

## Class ResponseCollector<T>

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

    public class ResponseCollector<T>
    extends java.lang.Object

Similar to AckCollector, but collects responses, not just acks. Null is not a valid key.

Author:
  Bela Ban

### Constructor Summary

Constructors
Constructor and Description
`ResponseCollector()`
`ResponseCollector(Address... members)`
`ResponseCollector(java.util.Collection<Address> members)`

### Method Summary

Methods
`void` `add(Address member, T data)`
`java.util.Map<Address,T>` `getResults()`
`boolean` `hasAllResponses()`
`void` `remove(Address member)`
`void` `reset()`
`void` `reset(Address... members)`
`void` `reset(java.util.Collection<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.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### 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 void add(Address member,
           T data)

#### remove

    public void remove(Address member)

#### suspect

    public void suspect(Address member)

#### hasAllResponses

    public boolean hasAllResponses()

#### 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`