Mercurial > hg > Database > Christie
view src/main/java/christie/test/topology/paxos/learner/RecieveAcceptProposalCodeGear.java @ 192:149d7fb0cfa6
refactor learner
author | akahori |
---|---|
date | Tue, 12 Feb 2019 16:11:16 +0900 |
parents | 1bffd8151c6a |
children |
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; //@Peek HashMap<String, Proposal> acceptedMap; public RecieveAcceptProposalCodeGear(HashMap<String, Proposal> acceptedMap){ this.acceptedMap=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(acceptedMap)); else cgm.setup(new RecieveAcceptProposalCodeGear(acceptedMap)); } }