| java.util.Hashtable org.jgroups.blocks.ReplicatedHashtable
ReplicatedHashtable | public class ReplicatedHashtable extends Hashtable implements MessageListener,MembershipListener(Code) | | Provides the abstraction of a java.util.Hashtable that is replicated at several
locations. Any change to the hashtable (clear, put, remove etc) will transparently be
propagated to all replicas in the group. All read-only methods will always access the
local replica.
Both keys and values added to the hashtable must be serializable, the reason
being that they will be sent across the network to all replicas of the group. Having said
this, it is now for example possible to add RMI remote objects to the hashtable as they
are derived from java.rmi.server.RemoteObject which in turn is serializable.
This allows to lookup shared distributed objects by their name and invoke methods on them,
regardless of one's onw location. A ReplicatedHashtable thus allows to
implement a distributed naming service in just a couple of lines.
An instance of this class will contact an existing member of the group to fetch its
initial state.
Contrary to DistributedHashtable, this class does not make use of RpcDispatcher (and RequestCorrelator)
but uses plain asynchronous messages instead.
author: Bela Ban author: Alfonso Olias-Sanz |
Inner Class :public interface Notification | |
Inner Class :public interface StateTransferListener | |
Constructor Summary | |
public | ReplicatedHashtable(String groupname, ChannelFactory factory, StateTransferListener l, String properties, long state_timeout) Creates a ReplicatedHashtable
Parameters: groupname - The name of the group to join Parameters: factory - The ChannelFactory which will be used to create a channel Parameters: properties - The property string to be used to define the channel Parameters: state_timeout - The time to wait until state is retrieved in milliseconds. | public | ReplicatedHashtable(String groupname, ChannelFactory factory, String properties, long state_timeout) | public | ReplicatedHashtable(JChannel channel, long state_timeout) | public | ReplicatedHashtable(JChannel channel, StateTransferListener l, long state_timeout) |
log | final protected transient Log log(Code) | | |
state_transfer_listeners | final transient List state_transfer_listeners(Code) | | |
state_transfer_running | transient boolean state_transfer_running(Code) | | |
ReplicatedHashtable | public ReplicatedHashtable(String groupname, ChannelFactory factory, StateTransferListener l, String properties, long state_timeout)(Code) | | Creates a ReplicatedHashtable
Parameters: groupname - The name of the group to join Parameters: factory - The ChannelFactory which will be used to create a channel Parameters: properties - The property string to be used to define the channel Parameters: state_timeout - The time to wait until state is retrieved in milliseconds. A value of 0 means wait forever. |
addNotifier | public void addNotifier(Notification n)(Code) | | |
addStateTransferListener | final public void addStateTransferListener(StateTransferListener l)(Code) | | |
block | public void block()(Code) | | Block sending and receiving of messages until ViewAccepted is called
|
clear | public void clear()(Code) | | Clears this hashtable so that it contains no keys
|
getState | public byte[] getState()(Code) | | |
notifyStateTransferCompleted | void notifyStateTransferCompleted(boolean success)(Code) | | |
notifyStateTransferStarted | void notifyStateTransferStarted()(Code) | | |
put | public Object put(Object key, Object value)(Code) | | Maps the specified key to the specified value in the hashtable. Neither of both parameters can be null
Parameters: key - - the hashtable key Parameters: value - - the value the previous value of the specified key in this hashtable, or null if it did not have one |
putAll | public void putAll(Map m)(Code) | | Copies all of the mappings from the specified Map to this Hashtable These mappings will replace any mappings that this Hashtable had for any of the keys currently in the specified Map.
Parameters: m - - Mappings to be stored in this map |
remove | public Object remove(Object key)(Code) | | Removes the key (and its corresponding value) from the Hashtable.
Parameters: key - - the key to be removed. the value to which the key had been mapped in this hashtable, or null if the key did not have a mapping. |
removeStateTransferListener | public void removeStateTransferListener(StateTransferListener l)(Code) | | |
sendViewChangeNotifications | void sendViewChangeNotifications(Vector new_mbrs, Vector old_mbrs)(Code) | | |
setState | public void setState(byte[] new_state)(Code) | | |
stateTransferRunning | public boolean stateTransferRunning()(Code) | | |
suspect | public void suspect(Address suspected_mbr)(Code) | | Called when a member is suspected
|
viewAccepted | public void viewAccepted(View new_view)(Code) | | |
|
|