Mercurial > hg > Database > Christie
view src/main/java/christie/test/topology/paxos/learner/RecieveAcceptProposalCodeGear.java @ 183:1bffd8151c6a
fix paxos
author | akahori |
---|---|
date | Sat, 02 Feb 2019 15:19:20 +0900 |
parents | 33b4966d4d24 |
children | 149d7fb0cfa6 |
line wrap: on
line source
package christie.test.topology.paxos.learner; import christie.annotation.Peek; import christie.annotation.Take; import christie.codegear.CodeGear; import christie.codegear.CodeGearManager; import christie.test.topology.paxos.Proposal; import java.util.HashMap; public class RecieveAcceptProposalCodeGear extends CodeGear{ @Take Proposal acceptedProposal; @Take HashMap<String, Proposal> acceptedMap; @Override protected void run(CodeGearManager cgm) { System.out.println("accepted : " + acceptedProposal); acceptedMap.put(acceptedProposal.getAcceptorName(), acceptedProposal); put("acceptedMap", acceptedMap); if(acceptedMap.size() > acceptedProposal.getAcceptorNum()/2) cgm.setup(new AggregateProposalCodeGear()); else cgm.setup(new RecieveAcceptProposalCodeGear()); } }