org.jgroups.util
Class RspList<T>

java.lang.Object
  extended by org.jgroups.util.RspList<T>
All Implemented Interfaces:
java.lang.Iterable<Rsp<T>>, java.util.Map<Address,Rsp<T>>

public class RspList<T>
extends java.lang.Object
implements java.util.Map<Address,Rsp<T>>, java.lang.Iterable<Rsp<T>>

Contains responses from all members. Marks faulty members. A RspList is a response list used in peer-to-peer protocols. This class is unsynchronized


Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Constructor Summary
RspList()
           
RspList(java.util.Collection<Rsp<T>> responses)
          Adds a list of responses
 
Method Summary
 void addNotReceived(Address sender)
           
 void addRsp(Address sender, T retval)
           
 void clear()
           
 boolean containsKey(java.lang.Object key)
           
 boolean containsValue(java.lang.Object value)
           
 java.util.Set<java.util.Map.Entry<Address,Rsp<T>>> entrySet()
           
 Rsp<T> get(java.lang.Object key)
          Returns the Rsp associated with address key
 T getFirst()
          Returns the first value in the response set.
 java.util.List<T> getResults()
          Returns the results from non-suspected members that are not null.
 java.util.List<Address> getSuspectedMembers()
           
 T getValue(java.lang.Object key)
          Returns the value associated with address key
 boolean isEmpty()
           
 boolean isReceived(Address sender)
           
 boolean isSuspected(Address sender)
           
 java.util.Iterator<Rsp<T>> iterator()
           
 java.util.Set<Address> keySet()
           
 int numReceived()
           
 int numSuspectedMembers()
           
 Rsp<T> put(Address key, Rsp<T> value)
           
 void putAll(java.util.Map<? extends Address,? extends Rsp<T>> m)
           
 Rsp<T> remove(java.lang.Object key)
           
 int size()
           
 java.lang.String toString()
           
 java.util.Collection<Rsp<T>> values()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

RspList

public RspList()

RspList

public RspList(java.util.Collection<Rsp<T>> responses)
Adds a list of responses

Parameters:
responses - Collection
Method Detail

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Map<Address,Rsp<T>>

containsKey

public boolean containsKey(java.lang.Object key)
Specified by:
containsKey in interface java.util.Map<Address,Rsp<T>>

containsValue

public boolean containsValue(java.lang.Object value)
Specified by:
containsValue in interface java.util.Map<Address,Rsp<T>>

get

public Rsp<T> get(java.lang.Object key)
Returns the Rsp associated with address key

Specified by:
get in interface java.util.Map<Address,Rsp<T>>
Parameters:
key - Address (key)
Returns:
Rsp

getValue

public T getValue(java.lang.Object key)
Returns the value associated with address key

Parameters:
key -
Returns:
Object value

put

public Rsp<T> put(Address key,
                  Rsp<T> value)
Specified by:
put in interface java.util.Map<Address,Rsp<T>>

remove

public Rsp<T> remove(java.lang.Object key)
Specified by:
remove in interface java.util.Map<Address,Rsp<T>>

putAll

public void putAll(java.util.Map<? extends Address,? extends Rsp<T>> m)
Specified by:
putAll in interface java.util.Map<Address,Rsp<T>>

clear

public void clear()
Specified by:
clear in interface java.util.Map<Address,Rsp<T>>

keySet

public java.util.Set<Address> keySet()
Specified by:
keySet in interface java.util.Map<Address,Rsp<T>>

values

public java.util.Collection<Rsp<T>> values()
Specified by:
values in interface java.util.Map<Address,Rsp<T>>

entrySet

public java.util.Set<java.util.Map.Entry<Address,Rsp<T>>> entrySet()
Specified by:
entrySet in interface java.util.Map<Address,Rsp<T>>

addRsp

public void addRsp(Address sender,
                   T retval)

addNotReceived

public void addNotReceived(Address sender)

isReceived

public boolean isReceived(Address sender)

numSuspectedMembers

public int numSuspectedMembers()

numReceived

public int numReceived()

getFirst

public T getFirst()
Returns the first value in the response set. This is random, but we try to return a non-null value first


getResults

public java.util.List<T> getResults()
Returns the results from non-suspected members that are not null.


getSuspectedMembers

public java.util.List<Address> getSuspectedMembers()

isSuspected

public boolean isSuspected(Address sender)

size

public int size()
Specified by:
size in interface java.util.Map<Address,Rsp<T>>

toString

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

iterator

public java.util.Iterator<Rsp<T>> iterator()
Specified by:
iterator in interface java.lang.Iterable<Rsp<T>>


Copyright © 1998-2012 Bela Ban / Red Hat. All Rights Reserved.