org.javagroups.blocks
Class TwoPhaseVotingAdapter
java.lang.Object
|
+--org.javagroups.blocks.TwoPhaseVotingAdapter
- public class TwoPhaseVotingAdapter
- extends java.lang.Object
This adapter introduces simple two-phase voting on a specified decree. All
nodes in the group receive a decree in "prepare" phase where they expres
their opinion on the decree. If all nodes voted positively on decree, next
phase "commit" fixes changes that were made in "prepare" phase, otherwise
changes are canceled in "abort" phase.
- Author:
- Roman Rokytskyy (rrokytskyy@acm.org)
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TwoPhaseVotingAdapter
public TwoPhaseVotingAdapter(VotingAdapter voteChannel)
- Creats an instance of the class.
- Parameters:
voteChannel
- the channel that will be used for voting.
addListener
public void addListener(TwoPhaseVotingListener listener)
- Wraps actual listener with the VoteChannelListener and adds to the
voteChannel
removeListener
public void removeListener(TwoPhaseVotingListener listener)
- Removes the listener from the voteChannel
vote
public boolean vote(java.lang.Object decree,
long timeout)
throws ChannelException
- Performs the two-phase voting on the decree. After the voting each
group member remains in the same state as others.
Copyright © 2001,2002 www.javagroups.com . All Rights Reserved.