159
|
1 package christie.test.topology.paxos.learner;
|
157
|
2
|
|
3 import christie.annotation.Peek;
|
|
4 import christie.annotation.Take;
|
|
5 import christie.codegear.CodeGear;
|
|
6 import christie.codegear.CodeGearManager;
|
159
|
7 import christie.test.topology.paxos.Proposal;
|
157
|
8
|
|
9 import java.util.HashMap;
|
|
10
|
|
11 public class RecieveAcceptProposalCodeGear extends CodeGear{
|
|
12
|
|
13 @Take
|
|
14 Proposal acceptedProposal;
|
|
15
|
|
16 @Take
|
|
17 HashMap<String, Proposal> acceptedMap;
|
|
18
|
|
19
|
|
20 @Override
|
|
21 protected void run(CodeGearManager cgm) {
|
181
|
22 System.out.println("accepted : " + acceptedProposal);
|
157
|
23 acceptedMap.put(acceptedProposal.getAcceptorName(),
|
|
24 acceptedProposal);
|
|
25 put("acceptedMap", acceptedMap);
|
159
|
26 if(acceptedMap.size() > acceptedProposal.getAcceptorNum()/2) cgm.setup(new AggregateProposalCodeGear());
|
183
|
27 else cgm.setup(new RecieveAcceptProposalCodeGear());
|
157
|
28 }
|
|
29 }
|