Java Doc for ReplicatedTree.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.lang.Object
   org.jgroups.blocks.ReplicatedTree

ReplicatedTree
public class ReplicatedTree implements Runnable,MessageListener,MembershipListener(Code)
A tree-like structure that is replicated across several members. Updates will be multicast to all group members reliably and in the same order.
author:
   Bela Ban Jan 17 2002
author:
   Alfonso Olias-Sanz

Inner Class :public interface ReplicatedTreeListener
Inner Class :public static class Node implements Serializable
Inner Class :static class MyListener implements ReplicatedTreeListener

Field Summary
final static  intINDENT
    
final public static  StringSEPARATOR
    
 PullPushAdapteradapter
    
 JChannelchannel
    
 Stringgroupname
    
 booleanjmx
    
final  Vectorlisteners
    
final protected  Loglog
    
final  Vectormembers
    
 Stringprops
    
 booleanremote_calls
     Whether or not to use remote calls.
 Threadrequest_handler
    
final  Queuerequest_queue
    
 Noderoot
    
 longstate_fetch_timeout
    

Constructor Summary
public  ReplicatedTree(String groupname, String props, long state_fetch_timeout)
     Creates a channel with the given properties.
public  ReplicatedTree(String groupname, String props, long state_fetch_timeout, boolean jmx)
    
public  ReplicatedTree()
    
public  ReplicatedTree(JChannel channel)
     Expects an already connected channel.

Method Summary
public  void_put(String fqn, HashMap data)
    
public  void_put(String fqn, String key, Object value)
    
public  void_remove(String fqn)
    
public  void_remove(String fqn, String key)
    
public  void_removeData(String fqn)
    
public  voidaddReplicatedTreeListener(ReplicatedTreeListener listener)
    
public  voidblock()
    
public  booleanexists(String fqn)
    
public  voidfetchState(long timeout)
     Fetch the group state from the current coordinator.
 NodefindNode(String fqn)
     Returns the node at fqn.
 NodefindParentNode(String fqn, StringHolder child_name, boolean create_if_not_exists)
     Find the node just above the one indicated by fqn.
public  Objectget(String fqn, String key)
     Finds a node given its name and returns the value associated with a given key in its data map.
 HashMapget(String fqn)
     Returns the data hashmap for a given node.
public  ChannelgetChannel()
    
public  SetgetChildrenNames(String fqn)
    
public  intgetGroupMembersNumber()
    
public  StringgetGroupName()
    
public  SetgetKeys(String fqn)
     Gets the keys of the data map.
public  AddressgetLocalAddress()
    
public  VectorgetMembers()
    
public  byte[]getState()
    
public static  voidmain(String[] args)
    
 voidnotifyAllNodesCreated(Node curr)
     Generates NodeAdded notifications for all nodes of the tree.
 voidnotifyNodeAdded(String fqn)
    
 voidnotifyNodeModified(String fqn)
    
 voidnotifyNodeRemoved(String fqn)
    
 voidnotifyViewChange(View v)
    
public  Stringprint(String fqn)
     Prints a representation of the node defined by fqn.
public  voidput(String fqn, HashMap data)
     Adds a new node to the tree and sets its data.
public  voidput(String fqn, String key, Object value)
     Adds a key and value to a given node.
public  voidreceive(Message msg)
     Callback.
public  voidremove(String fqn)
     Removes the node from the tree.
public  voidremove(String fqn, String key)
    
public  voidremoveReplicatedTreeListener(ReplicatedTreeListener listener)
    
public  voidrun()
    
public  voidsetRemoteCalls(boolean flag)
    
public  voidsetRootNode(Node n)
    
public  voidsetState(byte[] new_state)
    
final public  voidstart()
    
public  voidstop()
    
public  voidsuspect(Address suspected_mbr)
    
public  StringtoString()
    
public  voidviewAccepted(View new_view)
    

Field Detail
INDENT
final static int INDENT(Code)



SEPARATOR
final public static String SEPARATOR(Code)



adapter
PullPushAdapter adapter(Code)



channel
JChannel channel(Code)



groupname
String groupname(Code)



jmx
boolean jmx(Code)



listeners
final Vector listeners(Code)



log
final protected Log log(Code)



members
final Vector members(Code)



props
String props(Code)



remote_calls
boolean remote_calls(Code)
Whether or not to use remote calls. If false, all methods will be invoked directly on this instance rather than sending a message to all replicas and only then invoking the method. Useful for testing



request_handler
Thread request_handler(Code)



request_queue
final Queue request_queue(Code)



root
Node root(Code)



state_fetch_timeout
long state_fetch_timeout(Code)




Constructor Detail
ReplicatedTree
public ReplicatedTree(String groupname, String props, long state_fetch_timeout) throws Exception(Code)
Creates a channel with the given properties. Connects to the channel, then creates a PullPushAdapter and starts it



ReplicatedTree
public ReplicatedTree(String groupname, String props, long state_fetch_timeout, boolean jmx) throws Exception(Code)



ReplicatedTree
public ReplicatedTree()(Code)



ReplicatedTree
public ReplicatedTree(JChannel channel) throws Exception(Code)
Expects an already connected channel. Creates a PullPushAdapter and starts it




Method Detail
_put
public void _put(String fqn, HashMap data)(Code)



_put
public void _put(String fqn, String key, Object value)(Code)



_remove
public void _remove(String fqn)(Code)



_remove
public void _remove(String fqn, String key)(Code)



_removeData
public void _removeData(String fqn)(Code)



addReplicatedTreeListener
public void addReplicatedTreeListener(ReplicatedTreeListener listener)(Code)



block
public void block()(Code)
Block sending and receiving of messages until viewAccepted() is called



exists
public boolean exists(String fqn)(Code)
Checks whether a given node exists in the tree
Parameters:
  fqn - The fully qualified name of the node boolean Whether or not the node exists



fetchState
public void fetchState(long timeout) throws ChannelClosedException, ChannelNotConnectedException(Code)
Fetch the group state from the current coordinator. If successful, this will trigger setState().



findNode
Node findNode(String fqn)(Code)
Returns the node at fqn. This method should not be used by clients (therefore it is package-private): it is only used internally (for navigation). C++ 'friend' would come in handy here...
Parameters:
  fqn - The fully qualified name of the node Node The node at fqn



findParentNode
Node findParentNode(String fqn, StringHolder child_name, boolean create_if_not_exists)(Code)
Find the node just above the one indicated by fqn. This is needed in many cases, e.g. to add a new node or remove an existing node.
Parameters:
  fqn - The fully qualified name of the node.
Parameters:
  child_name - Will be filled with the name of the child when this method returns. The child nameis the last relative name of the fqn, e.g. in "/a/b/c" it would be "c".
Parameters:
  create_if_not_exists - Create parent nodes along the way if they don't exist. Otherwise, this methodwill return when a node cannot be found.



get
public Object get(String fqn, String key)(Code)
Finds a node given its name and returns the value associated with a given key in its data map. Returns null if the node was not found in the tree or the key was not found in the hashmap.
Parameters:
  fqn - The fully qualified name of the node.
Parameters:
  key - The key.



get
HashMap get(String fqn)(Code)
Returns the data hashmap for a given node. This method can only be used by callers that are inside the same package. The reason is that callers must not modify the return value, as these modifications would not be replicated, thus rendering the replicas inconsistent.
Parameters:
  fqn - The fully qualified name of the node HashMap The data hashmap for the given node



getChannel
public Channel getChannel()(Code)
Returns the Channel the DistributedTree is connected to Channel



getChildrenNames
public Set getChildrenNames(String fqn)(Code)
Returns all children of a given node
Parameters:
  fqn - The fully qualified name of the node Set A list of child names (as Strings)



getGroupMembersNumber
public int getGroupMembersNumber()(Code)
Returns the number of current members joined to the group int



getGroupName
public String getGroupName()(Code)
Returns the name of the group that the DistributedTree is connected to String



getKeys
public Set getKeys(String fqn)(Code)
Gets the keys of the data map. Returns all keys as Strings. Returns null if node does not exist.
Parameters:
  fqn - The fully qualified name of the node Set A set of keys (as Strings)



getLocalAddress
public Address getLocalAddress()(Code)



getMembers
public Vector getMembers()(Code)



getState
public byte[] getState()(Code)
Return a copy of the current cache (tree)



main
public static void main(String[] args)(Code)



notifyAllNodesCreated
void notifyAllNodesCreated(Node curr)(Code)
Generates NodeAdded notifications for all nodes of the tree. This is called whenever the tree is initially retrieved (state transfer)



notifyNodeAdded
void notifyNodeAdded(String fqn)(Code)



notifyNodeModified
void notifyNodeModified(String fqn)(Code)



notifyNodeRemoved
void notifyNodeRemoved(String fqn)(Code)



notifyViewChange
void notifyViewChange(View v)(Code)



print
public String print(String fqn)(Code)
Prints a representation of the node defined by fqn. Output includes name, fqn and data.



put
public void put(String fqn, HashMap data)(Code)
Adds a new node to the tree and sets its data. If the node doesn not yet exist, it will be created. Also, parent nodes will be created if not existent. If the node already has data, then the new data will override the old one. If the node already existed, a nodeModified() notification will be generated. Otherwise a nodeCreated() motification will be emitted.
Parameters:
  fqn - The fully qualified name of the new node
Parameters:
  data - The new data. May be null if no data should be set in the node.



put
public void put(String fqn, String key, Object value)(Code)
Adds a key and value to a given node. If the node doesn't exist, it will be created. If the node already existed, a nodeModified() notification will be generated. Otherwise a nodeCreated() motification will be emitted.
Parameters:
  fqn - The fully qualified name of the node
Parameters:
  key - The key
Parameters:
  value - The value



receive
public void receive(Message msg)(Code)
Callback. Process the contents of the message; typically an _add() or _set() request



remove
public void remove(String fqn)(Code)
Removes the node from the tree.
Parameters:
  fqn - The fully qualified name of the node.



remove
public void remove(String fqn, String key)(Code)
Removes key from the node's hashmap
Parameters:
  fqn - The fullly qualified name of the node
Parameters:
  key - The key to be removed



removeReplicatedTreeListener
public void removeReplicatedTreeListener(ReplicatedTreeListener listener)(Code)



run
public void run()(Code)
Request handler thread



setRemoteCalls
public void setRemoteCalls(boolean flag)(Code)



setRootNode
public void setRootNode(Node n)(Code)



setState
public void setState(byte[] new_state)(Code)
Set the cache (tree) to this value



start
final public void start() throws Exception(Code)



stop
public void stop()(Code)



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



toString
public String toString()(Code)



viewAccepted
public void viewAccepted(View new_view)(Code)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(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.