Java Doc for DistributedHashtable.java in  » Net » JGroups-2.4.1-sp3 » org » jgroups » blocks » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Net » JGroups 2.4.1 sp3 » org.jgroups.blocks 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


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

Field Summary
protected transient  RpcDispatcherdisp
    
final protected  Loglog
    
final protected transient  Promisestate_promise
    

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)
    

Method Summary
public  void_clear()
    
public  Object_put(Object key, Object value)
    
public  void_putAll(Map m)
    
public  Object_remove(Object key)
    
public  voidaddNotifier(Notification n)
    
public  voidblock()
    
public  voidclear()
    
public  ChannelgetChannel()
    
public  StringgetGroupName()
    
public  AddressgetLocalAddress()
    
public  booleangetPersistent()
    
public  byte[]getState()
    
final protected  voidinit(long state_timeout)
    
final  voidinitSignatures()
    
public static  voidmain(String[] args)
    
public  Objectput(Object key, Object value)
     Maps the specified key to the specified value in the hashtable.
public  voidputAll(Map m)
     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.
public  voidreceive(Message msg)
    
public  Objectremove(Object key)
     Removes the key (and its corresponding value) from the Hashtable.
Parameters:
  key - - the key to be removed.
public  voidremoveNotifier(Notification n)
    
 voidsendViewChangeNotifications(Vector new_mbrs, Vector old_mbrs)
    
public  voidsetDeadlockDetection(boolean flag)
    
public  voidsetPersistent(boolean p)
    
public  voidsetState(byte[] new_state)
    
final public  voidstart(long state_timeout)
    
public  voidstop()
    
public  voidsuspect(Address suspected_mbr)
    
public  voidviewAccepted(View new_view)
    

Field Detail
disp
protected transient RpcDispatcher disp(Code)



log
final protected Log log(Code)



state_promise
final protected transient Promise state_promise(Code)




Constructor Detail
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



DistributedHashtable
public DistributedHashtable(PullPushAdapter adapter, Serializable id)(Code)




Method Detail
_clear
public void _clear()(Code)



_put
public Object _put(Object key, Object value)(Code)



_putAll
public void _putAll(Map m)(Code)

See Also:   java.util.Map.putAll(java.util.Map)



_remove
public Object _remove(Object key)(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



getChannel
public Channel getChannel()(Code)



getGroupName
public String getGroupName()(Code)



getLocalAddress
public Address getLocalAddress()(Code)



getPersistent
public boolean getPersistent()(Code)



getState
public byte[] getState()(Code)



init
final protected void init(long state_timeout)(Code)



initSignatures
final void initSignatures()(Code)



main
public static void main(String[] args)(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



receive
public void receive(Message msg)(Code)



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)



start
final public void start(long state_timeout) throws ChannelClosedException, ChannelNotConnectedException(Code)
Fetches the state
Parameters:
  state_timeout -
throws:
  ChannelClosedException -
throws:
  ChannelNotConnectedException -



stop
public void stop()(Code)



suspect
public void suspect(Address suspected_mbr)(Code)
Called when a member is suspected



viewAccepted
public void viewAccepted(View new_view)(Code)



Methods inherited from java.util.Hashtable
public synchronized void clear()(Code)(Java Doc)
public synchronized Object clone()(Code)(Java Doc)
public synchronized boolean contains(Object value)(Code)(Java Doc)
public synchronized boolean containsKey(Object key)(Code)(Java Doc)
public boolean containsValue(Object value)(Code)(Java Doc)
public synchronized Enumeration<V> elements()(Code)(Java Doc)
public Set<Map.Entry<K, V>> entrySet()(Code)(Java Doc)
public synchronized boolean equals(Object o)(Code)(Java Doc)
public synchronized V get(Object key)(Code)(Java Doc)
public synchronized int hashCode()(Code)(Java Doc)
public synchronized boolean isEmpty()(Code)(Java Doc)
public Set<K> keySet()(Code)(Java Doc)
public synchronized Enumeration<K> keys()(Code)(Java Doc)
public synchronized V put(K key, V value)(Code)(Java Doc)
public synchronized void putAll(Map<? extends K, ? extends V> t)(Code)(Java Doc)
protected void rehash()(Code)(Java Doc)
public synchronized V remove(Object key)(Code)(Java Doc)
public synchronized int size()(Code)(Java Doc)
public synchronized String toString()(Code)(Java Doc)
public Collection<V> values()(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.