All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class JavaGroups.DistributedHashtable

java.lang.Object
   |
   +----java.util.Dictionary
           |
           +----java.util.Hashtable
                   |
                   +----JavaGroups.DistributedHashtable

public class DistributedHashtable
extends Hashtable
implements StateExchange, Cloneable
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.


Constructor Index

 o DistributedHashtable(String, ChannelFactory)

Method Index

 o _clear()
 o _put(Object, Object)
 o _remove(Object)
 o AddNotifier(DistributedHashtable. Notification)
 o clear()
 o finalize()
 o GetState()
 o put(Object, Object)
 o remove(Object)
 o SaveState()
 o SetState(Object)

Constructors

 o DistributedHashtable
 public DistributedHashtable(String groupname,
                             ChannelFactory factory)

Methods

 o finalize
 public void finalize() throws Throwable
Overrides:
finalize in class Object
 o AddNotifier
 public void AddNotifier(DistributedHashtable. Notification n)
 o put
 public synchronized Object put(Object key,
                                Object value)
Overrides:
put in class Hashtable
 o clear
 public synchronized void clear()
Overrides:
clear in class Hashtable
 o remove
 public synchronized Object remove(Object key)
Overrides:
remove in class Hashtable
 o _put
 public synchronized Object _put(Object key,
                                 Object value)
 o _clear
 public synchronized void _clear()
 o _remove
 public synchronized Object _remove(Object key)
 o SaveState
 public synchronized void SaveState()
 o GetState
 public Object GetState()
 o SetState
 public synchronized void SetState(Object new_state)

All Packages  Class Hierarchy  This Package  Previous  Next  Index