| java.util.Hashtable org.jgroups.blocks.DistributedHashtable
All known Subclasses: org.jgroups.demos.DistributedHashtableDemo,
DistributedHashtable | public class DistributedHashtable 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 DistributedHashtable 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 (using the state exchange funclet StateExchangeFunclet .
author: Bela Ban author: Alfonso Olias-Sanz version: $Id: DistributedHashtable.java,v 1.26.2.2 2007/04/26 16:43:00 vlada Exp $ |
Inner Class :public interface Notification | |
Constructor Summary | |
public | DistributedHashtable(String groupname, ChannelFactory factory, String properties, long state_timeout) Creates a DistributedHashtable
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. | public | DistributedHashtable(String groupname, ChannelFactory factory, String properties, boolean persistent, long state_timeout) Creates a DisttributedHashtable. | public | DistributedHashtable(Channel channel, long state_timeout) | public | DistributedHashtable(Channel channel, boolean persistent, long state_timeout) | public | DistributedHashtable(PullPushAdapter adapter, Serializable id, long state_timeout) Uses a user-provided PullPushAdapter to create the dispatcher rather than a Channel. | public | DistributedHashtable(PullPushAdapter adapter, Serializable id) |
log | final protected Log log(Code) | | |
state_promise | final protected transient Promise state_promise(Code) | | |
DistributedHashtable | public DistributedHashtable(String groupname, ChannelFactory factory, String properties, long state_timeout) throws ChannelException(Code) | | Creates a DistributedHashtable
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. This will override the properties ofthe factory. If null, then the factory properties will be used Parameters: state_timeout - The time to wait until state is retrieved in milliseconds. A value of 0 means wait forever. |
DistributedHashtable | public DistributedHashtable(String groupname, ChannelFactory factory, String properties, boolean persistent, long state_timeout) throws ChannelException(Code) | | Creates a DisttributedHashtable. Optionally the contents can be saved to
persistemt storage using the
PersistenceManager .
Parameters: groupname - Name of the group to join Parameters: factory - Instance of a ChannelFactory to create the channel Parameters: properties - Protocol stack properties. This will override the properties of the factory. Ifnull, then the factory properties will be used Parameters: persistent - Whether the contents should be persisted Parameters: state_timeout - Max number of milliseconds to wait until state isretrieved |
DistributedHashtable | public DistributedHashtable(Channel channel, long state_timeout)(Code) | | |
DistributedHashtable | public DistributedHashtable(Channel channel, boolean persistent, long state_timeout)(Code) | | |
DistributedHashtable | public DistributedHashtable(PullPushAdapter adapter, Serializable id, long state_timeout) throws ChannelNotConnectedException, ChannelClosedException(Code) | | Uses a user-provided PullPushAdapter to create the dispatcher rather than a Channel. If id is non-null, it will be
used to register under that id. This is typically used when another building block is already using
PullPushAdapter, and we want to add this building block in addition. The id is the used to discriminate
between messages for the various blocks on top of PullPushAdapter. If null, we will assume we are the
first block created on PullPushAdapter.
Parameters: adapter - The PullPushAdapter which to use as underlying transport Parameters: id - A serializable object (e.g. an Integer) used to discriminate (multiplex/demultiplex) betweenrequests/responses for different building blocks on top of PullPushAdapter. Parameters: state_timeout - Max number of milliseconds to wait until state isretrieved |
_clear | public void _clear()(Code) | | |
addNotifier | public void addNotifier(Notification n)(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
|
getPersistent | public boolean getPersistent()(Code) | | |
getState | public byte[] getState()(Code) | | |
init | final protected void init(long state_timeout)(Code) | | |
initSignatures | final void initSignatures()(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. |
removeNotifier | public void removeNotifier(Notification n)(Code) | | |
sendViewChangeNotifications | void sendViewChangeNotifications(Vector new_mbrs, Vector old_mbrs)(Code) | | |
setDeadlockDetection | public void setDeadlockDetection(boolean flag)(Code) | | |
setPersistent | public void setPersistent(boolean p)(Code) | | |
setState | public void setState(byte[] new_state)(Code) | | |
suspect | public void suspect(Address suspected_mbr)(Code) | | Called when a member is suspected
|
viewAccepted | public void viewAccepted(View new_view)(Code) | | |
|
|