Java Doc for ReplicationManager.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.ReplicationManager

ReplicationManager
public class ReplicationManager implements RequestHandler(Code)
Class to propagate updates to a number of nodes in various ways:
  1. Asynchronous
  2. Synchronous
  3. Synchronous with locking

Note: This class is experimental as of Oct 2002
author:
   Bela Ban Oct 2002


Field Summary
protected  MessageDispatcherdisp
    
 Addresslocal_addr
    
final protected  Loglog
    
 ReplicationReceiverreceiver
    

Constructor Summary
public  ReplicationManager(Channel channel, MessageListener ml, MembershipListener l, ReplicationReceiver receiver)
    
public  ReplicationManager(PullPushAdapter adapter, Serializable id, MessageListener ml, MembershipListener l, ReplicationReceiver receiver)
    

Method Summary
public  Xidbegin()
     Create a new transaction.
public  Xidbegin(int transaction_mode)
     Create a new transaction.
public  voidcommit(Xid transaction)
     Commits all modifications sent to the receivers via ReplicationManager.send and releases all locks associated with this transaction.
public  Objecthandle(Message msg)
    
protected  voidhandleCommit(Xid transaction)
    
protected  voidhandleRollback(Xid transaction)
    
protected  ObjecthandleSend(ReplicationData data)
    
public  voidrollback(Xid transaction)
     Discards all modifications sent to the receivers via ReplicationManager.send and releases all locks associated with this transaction.
public  RspListsend(Address dest, byte[] data, boolean synchronous, long synchronous_timeout, Xid transaction, byte[] lock_info, long lock_acquisition_timeout, long lock_lease_timeout, boolean use_locks)
     Sends a request to all members of the group.
 voidsendMessage(int type, Xid transaction)
    
public  voidsetMembershipListener(MembershipListener l)
    
public  voidsetReplicationReceiver(ReplicationReceiver handler)
    
public  voidstop()
    

Field Detail
disp
protected MessageDispatcher disp(Code)
Used to broadcast updates and receive responses (latter only in synchronous case)



local_addr
Address local_addr(Code)



log
final protected Log log(Code)



receiver
ReplicationReceiver receiver(Code)




Constructor Detail
ReplicationManager
public ReplicationManager(Channel channel, MessageListener ml, MembershipListener l, ReplicationReceiver receiver)(Code)
Creates an instance of ReplicationManager on top of a Channel



ReplicationManager
public ReplicationManager(PullPushAdapter adapter, Serializable id, MessageListener ml, MembershipListener l, ReplicationReceiver receiver)(Code)
Creates an instance of ReplicationManager on top of a PullPushAdapter




Method Detail
begin
public Xid begin() throws Exception(Code)
Create a new transaction. The transaction will be used to send updates, identify updates in the same transaction, and eventually commit or rollback the changes associated with the transaction. Xid A unique transaction
exception:
  Exception - Thrown when local_addr is null



begin
public Xid begin(int transaction_mode) throws Exception(Code)
Create a new transaction. The tracsion will be used to send updates, identify updates in the same transaction, and eventually commit or rollback the changes associated with the transaction.
Parameters:
  transaction_mode - Mode in which the transaction should run. Possible values are Xid.DIRTY_READS,Xid.READ_COMMITTED, Xid.REPEATABLE_READ and Xid.SERIALIZABLE Xid A unique transaction
exception:
  Exception - Thrown when local_addr is null



commit
public void commit(Xid transaction)(Code)
Commits all modifications sent to the receivers via ReplicationManager.send and releases all locks associated with this transaction. If modifications were made to stable storage (but not to resource), those modifications would now need to be transferred to the resource (e.g. database).



handle
public Object handle(Message msg)(Code)



handleCommit
protected void handleCommit(Xid transaction)(Code)



handleRollback
protected void handleRollback(Xid transaction)(Code)



handleSend
protected Object handleSend(ReplicationData data) throws UpdateException, LockingException(Code)



rollback
public void rollback(Xid transaction)(Code)
Discards all modifications sent to the receivers via ReplicationManager.send and releases all locks associated with this transaction.



send
public RspList send(Address dest, byte[] data, boolean synchronous, long synchronous_timeout, Xid transaction, byte[] lock_info, long lock_acquisition_timeout, long lock_lease_timeout, boolean use_locks)(Code)
Sends a request to all members of the group. Sending is asynchronous (return immediately) or synchronous (wait for all members to respond). If use_locking is true, then locking will be used at the receivers to acquire locks before accessing/updating a resource. Locks can be explicitly set using lock_info or implicitly through data. In the latter case, locks are induced from the data sent, e.g. if the data is a request for updating a certain row in a table, then we need to acquire a lock for that table.

In case of using locks, if the transaction associated with update already has a lock for a given resource, we will return. Otherwise, we will wait for lock_acquisition_timeout milliseconds. If the lock is not granted within that time a LockingException will be thrown. (We hope to replace this timeout with a distributed deadlock detection algorithm in the future.)

We have 3 main use case for this method:

  1. Asynchronous: sends the message and returns immediately. Argument asynchronous needs to be true. All other arguments except data are ignored and can be null. Will call update() on the registered ReplicationReceiver at each receiver.
  2. Synchronous without locks: sends the message, but returns only after responses from all members have been received, or synchronous_timeout milliseconds have elapsed (whichever comes first). Argument asynchronous needs to be false. Argument synchronous_timeout needs to be >= 0. If it is null the call will not time out, but wait for all responses. All other arguments (besides data are ignored).
  3. Synchronous with locks: sends the message, but returns only after responses from all members have been received, or synchronous_timeout milliseconds have elapsed (whichever comes first). At the receiver's side we have to acquire a lock for the resource to be updated, if the acquisition fails a LockingException will be thrown. The resource to be locked can be found in two ways: either data contains the resource(c) to be acquired implicitly, or lock_info lists the resources explicitly, or both. All the locks acquired at the receiver's side should be associated with transaction. When a commit() is received, the receiver should commit the modifications to the resource and release all locks. When a rollback() is received, the receiver should remove all (temporary) modifications and release all locks associated with transaction.
In both the synchronous cases a List of byte[] will be returned if the data was sent to all receivers successfully, cointaining byte buffers. The list may be empty.
Parameters:
  dest - The destination to which to send the message. Will be sent to all members if null.
Parameters:
  data - The data to be sent to all members. It may contain information about the resource to be locked.
Parameters:
  synchronous - If false the call is asynchronous, ie. non-blocking. If true, the method will waituntil responses from all members have been received (unless a timeout is defined, see below)
Parameters:
  synchronous_timeout - In a synchronous call, we will wait for responses from all members or untilsynchronous_timeout have elapsed (whichever comes first). 0 meansto wait forever.
Parameters:
  transaction - The transaction under which all locks for resources should be acquired. The receiverwill probably maintain a lock table with resources as keys and transactions as values.When an update is received, the receiver checks its lock table: if the resource isnot yet taken, the resource/transaction pair will be added to the lock table. Otherwise,we check if the transaction's owner associated with the resource is the same as the caller.If this is the case, the lock will be considered granted, otherwise we will wait for theresource to become available (for a certain amount of time). When a transaction is committed or rolled back, all resources associated with this transaction will be released.
Parameters:
  lock_info - Information about resource(s) to be acquired. This may be null, e.g. if this informationis already implied in data. Both data and lock_infomay be used to define the set of resources to be acquired.
Parameters:
  lock_acquisition_timeout - The number of milliseconds to wait until a lock acquisition request isconsidered failed (causing a LockingException). If 0 we will wait forever.(Note that this may lead to deadlocks).
Parameters:
  lock_lease_timeout - The number of milliseconds we want to keep the lock for a resource. Afterthis time has elapsed, the lock will be released. If 0 we won't release the lock(s)
Parameters:
  use_locks - If this is false, we will ignore all lock information (even if it is specified) andnot use locks at all. RspList A list of Rsps (org.jgroups.util.Rsp), one for each member. Each one is the result ofReplicationReceiver.receive. If a member didn't send a response, the receivedfield will be false. If the member was suspected while waiting for a response, the suspected field will be true. If the receive() method in the receiver returneda value it will be in field retval. If the receiver threw an exception it will alsobe in this field.



sendMessage
void sendMessage(int type, Xid transaction)(Code)



setMembershipListener
public void setMembershipListener(MembershipListener l)(Code)



setReplicationReceiver
public void setReplicationReceiver(ReplicationReceiver handler)(Code)



stop
public void stop()(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.