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

VotingAdapter
public class VotingAdapter implements MessageListener,MembershipListener,VoteResponseProcessor(Code)
Voting adapter provides a voting functionality for an application. There should be at most one VotingAdapter listening on one Channel instance. Each adapter can have zero or more registered VotingListener instances that will be called during voting process.

Decree is an object that has some semantic meaning within the application. Each voting listener receives a decree and can respond with either true or false. If the decree has no meaning for the voting listener, it is required to throw VoteException . In this case this specific listener will be excluded from the voting on the specified decree. After performing local voting, this voting adapter sends the request back to the originator of the voting process. Originator receives results from each node and decides if all voting process succeeded or not depending on the consensus type specified during voting.
author:
   Roman Rokytskyy (rrokytskyy@acm.org)
author:
   Robert Schaffar-Taurok (robert@fusion.at)
version:
   $Id: VotingAdapter.java,v 1.10 2006/09/27 12:42:53 belaban Exp $


Inner Class :public static class VoteResult implements Serializable
Inner Class :public static class FailureVoteResult extends VoteResult

Field Summary
final public static  intVOTE_ALL
     This consensus type means that at least one positive vote and no negative votes are required for the voting to succeed.
final public static  intVOTE_ANY
     This consensus type means that at least one positive vote is required for the voting to succeed.
final public static  intVOTE_MAJORITY
     This consensus type means that number of positive votes should be greater than number of negative votes.
final protected  Loglog
    

Constructor Summary
public  VotingAdapter(Channel channel)
     Creates an instance of the VoteChannel that uses JGroups for communication between group members.
public  VotingAdapter(PullPushAdapter adapter, Serializable id)
    

Method Summary
public  voidaddMembershipListener(MembershipListener l)
    
public  voidaddVoteListener(VotingListener listener)
     Adds voting listener.
public  voidblock()
     Blocks the channel until the ViewAccepted is invoked.
public static  StringgetConsensusStr(int consensusType)
     Convert consensus type into string representation.
public  CollectiongetMembers()
    
public  byte[]getState()
     Get the channel state.
public  VoteResultlocalVote(Object decree)
     This method performs voting on the specific decree between all local voteListeners.
public  booleanprocessResponses(RspList responses, int consensusType, Object decree)
     Processes the response list and makes a decision according to the type of the consensus for current voting.
public  voidreceive(org.jgroups.Message msg)
     Receive the message.
public  voidremoveMembershipListener(MembershipListener l)
    
public  voidremoveVoteListener(VotingListener listener)
     Removes voting listener.
public  voidsetState(byte[] state)
     Set the channel state.
public  voidsuspect(Address suspected)
    
public  voidviewAccepted(View newView)
     Callback for notification about the new view of the group.
public  booleanvote(Object decree, int consensusType, long timeout)
     Performs actual voting on the VoteChannel using the JGroups facilities for communication.
public  booleanvote(Object decree, int consensusType, long timeout, VoteResponseProcessor voteResponseProcessor)
     Performs actual voting on the VoteChannel using the JGroups facilities for communication.
public  booleanvote(Object decree, long timeout)
     Vote on the specified decree requiring all nodes to vote.
Parameters:
  decree - decree on which nodes should vote.
Parameters:
  timeout - time during which nodes can vote.
public  booleanvote(Object decree, long timeout, VoteResponseProcessor voteResponseProcessor)
     Vote on the specified decree requiring all nodes to vote.
Parameters:
  decree - decree on which nodes should vote.
Parameters:
  timeout - time during which nodes can vote.
Parameters:
  voteResponseProcessor - processor which will be called for every response that is received.

Field Detail
VOTE_ALL
final public static int VOTE_ALL(Code)
This consensus type means that at least one positive vote and no negative votes are required for the voting to succeed.



VOTE_ANY
final public static int VOTE_ANY(Code)
This consensus type means that at least one positive vote is required for the voting to succeed.



VOTE_MAJORITY
final public static int VOTE_MAJORITY(Code)
This consensus type means that number of positive votes should be greater than number of negative votes.



log
final protected Log log(Code)




Constructor Detail
VotingAdapter
public VotingAdapter(Channel channel)(Code)
Creates an instance of the VoteChannel that uses JGroups for communication between group members.
Parameters:
  channel - JGroups channel.



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




Method Detail
addMembershipListener
public void addMembershipListener(MembershipListener l)(Code)



addVoteListener
public void addVoteListener(VotingListener listener)(Code)
Adds voting listener.



block
public void block()(Code)
Blocks the channel until the ViewAccepted is invoked.



getConsensusStr
public static String getConsensusStr(int consensusType)(Code)
Convert consensus type into string representation. This method is useful for debugginf.
Parameters:
  consensusType - type of the consensus. string representation of the consensus type.



getMembers
public Collection getMembers()(Code)



getState
public byte[] getState()(Code)
Get the channel state. always null, we do not have any group-sharedstate.



localVote
public VoteResult localVote(Object decree)(Code)
This method performs voting on the specific decree between all local voteListeners.



processResponses
public boolean processResponses(RspList responses, int consensusType, Object decree) throws ChannelException(Code)
Processes the response list and makes a decision according to the type of the consensus for current voting.

Note: we do not support voting in case of Byzantine failures, i.e. when the node responds with the fault message.




receive
public void receive(org.jgroups.Message msg)(Code)
Receive the message. All messages are ignored.
Parameters:
  msg - message to check.



removeMembershipListener
public void removeMembershipListener(MembershipListener l)(Code)



removeVoteListener
public void removeVoteListener(VotingListener listener)(Code)
Removes voting listener.



setState
public void setState(byte[] state)(Code)
Set the channel state. We do nothing here.



suspect
public void suspect(Address suspected)(Code)
Callback for notification that one node is suspected



viewAccepted
public void viewAccepted(View newView)(Code)
Callback for notification about the new view of the group.



vote
public boolean vote(Object decree, int consensusType, long timeout) throws ChannelException(Code)
Performs actual voting on the VoteChannel using the JGroups facilities for communication.



vote
public boolean vote(Object decree, int consensusType, long timeout, VoteResponseProcessor voteResponseProcessor) throws ChannelException(Code)
Performs actual voting on the VoteChannel using the JGroups facilities for communication.



vote
public boolean vote(Object decree, long timeout) throws ChannelException(Code)
Vote on the specified decree requiring all nodes to vote.
Parameters:
  decree - decree on which nodes should vote.
Parameters:
  timeout - time during which nodes can vote. true if nodes agreed on a decree, otherwise false
throws:
  ChannelException - if something went wrong.



vote
public boolean vote(Object decree, long timeout, VoteResponseProcessor voteResponseProcessor) throws ChannelException(Code)
Vote on the specified decree requiring all nodes to vote.
Parameters:
  decree - decree on which nodes should vote.
Parameters:
  timeout - time during which nodes can vote.
Parameters:
  voteResponseProcessor - processor which will be called for every response that is received. true if nodes agreed on a decree, otherwise false
throws:
  ChannelException - if something went wrong.



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.