org.jgroups.util
Class RspList

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

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

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>
 
Field Summary
static RspList EMPTY_RSP_LIST
           
 
Constructor Summary
RspList()
           
RspList(java.util.Collection<Rsp> responses)
          Adds a list of responses
 
Method Summary
 void addNotReceived(Address sender)
           
 void addRsp(Address sender, java.lang.Object retval)
           
 void addSuspect(Address sender)
           
 void clear()
           
 boolean containsKey(java.lang.Object key)
           
 boolean containsValue(java.lang.Object value)
           
 java.lang.Object elementAt(int i)
          Deprecated. Use entrySet() or values() instead
 java.util.Set<java.util.Map.Entry<Address,Rsp>> entrySet()
           
 Rsp get(java.lang.Object key)
          Returns the Rsp associated with address key
 java.lang.Object getFirst()
          Returns the first value in the response set.
 java.util.Vector<java.lang.Object> getResults()
          Returns the results from non-suspected members that are not null.
 java.util.Vector<Address> getSuspectedMembers()
           
 java.lang.Object getValue(java.lang.Object key)
          Returns the value associated with address key
 boolean isEmpty()
           
 boolean isReceived(Address sender)
           
 boolean isSuspected(Address sender)
           
 java.util.Set<Address> keySet()
           
 int numReceived()
           
 int numSuspectedMembers()
           
 Rsp put(Address key, Rsp value)
           
 void putAll(java.util.Map<? extends Address,? extends Rsp> m)
           
 Rsp remove(java.lang.Object key)
           
 void reset()
          Deprecated. Use clear() instead
 int size()
           
 java.lang.String toString()
           
 java.util.Collection<Rsp> 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
 

Field Detail

EMPTY_RSP_LIST

public static final RspList EMPTY_RSP_LIST
Constructor Detail

RspList

public RspList()

RspList

public RspList(java.util.Collection<Rsp> 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>

containsKey

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

containsValue

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

get

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

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

getValue

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

Parameters:
key -
Returns:
Object value

put

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

remove

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

putAll

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

clear

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

keySet

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

values

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

entrySet

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

reset

public void reset()
Deprecated. Use clear() instead

Clears the response list


addRsp

public void addRsp(Address sender,
                   java.lang.Object retval)

addNotReceived

public void addNotReceived(Address sender)

addSuspect

public void addSuspect(Address sender)

isReceived

public boolean isReceived(Address sender)

numSuspectedMembers

public int numSuspectedMembers()

numReceived

public int numReceived()

getFirst

public java.lang.Object 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.Vector<java.lang.Object> getResults()
Returns the results from non-suspected members that are not null.


getSuspectedMembers

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

isSuspected

public boolean isSuspected(Address sender)

size

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

elementAt

public java.lang.Object elementAt(int i)
                           throws java.lang.ArrayIndexOutOfBoundsException
Deprecated. Use entrySet() or values() instead

Returns the Rsp at index i

Parameters:
i - The index
Returns:
a Rsp
Throws:
java.lang.ArrayIndexOutOfBoundsException

toString

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


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