Mercurial > hg > Database > Christie
comparison 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 |
comparison
equal
deleted
inserted
replaced
191:3a4f77778d90 | 192:149d7fb0cfa6 |
---|---|
11 public class RecieveAcceptProposalCodeGear extends CodeGear{ | 11 public class RecieveAcceptProposalCodeGear extends CodeGear{ |
12 | 12 |
13 @Take | 13 @Take |
14 Proposal acceptedProposal; | 14 Proposal acceptedProposal; |
15 | 15 |
16 @Take | 16 //@Peek |
17 HashMap<String, Proposal> acceptedMap; | 17 HashMap<String, Proposal> acceptedMap; |
18 | |
19 public RecieveAcceptProposalCodeGear(HashMap<String, Proposal> acceptedMap){ | |
20 this.acceptedMap=acceptedMap; | |
21 } | |
18 | 22 |
19 | 23 |
20 @Override | 24 @Override |
21 protected void run(CodeGearManager cgm) { | 25 protected void run(CodeGearManager cgm) { |
22 System.out.println("accepted : " + acceptedProposal); | 26 System.out.println("accepted : " + acceptedProposal); |
23 acceptedMap.put(acceptedProposal.getAcceptorName(), | 27 acceptedMap.put(acceptedProposal.getAcceptorName(), |
24 acceptedProposal); | 28 acceptedProposal); |
25 put("acceptedMap", acceptedMap); | 29 //put("acceptedMap", acceptedMap); |
26 if(acceptedMap.size() > acceptedProposal.getAcceptorNum()/2) cgm.setup(new AggregateProposalCodeGear()); | 30 |
27 else cgm.setup(new RecieveAcceptProposalCodeGear()); | 31 if(acceptedMap.size() > acceptedProposal.getAcceptorNum()/2) |
32 cgm.setup(new AggregateProposalCodeGear(acceptedMap)); | |
33 else | |
34 cgm.setup(new RecieveAcceptProposalCodeGear(acceptedMap)); | |
28 } | 35 } |
29 } | 36 } |