annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
159
a0391cfdcef6 update topologymanager
akahori
parents: 157
diff changeset
1 package christie.test.topology.paxos.learner;
157
7a2108775da7 update paxos done
akahori
parents:
diff changeset
2
7a2108775da7 update paxos done
akahori
parents:
diff changeset
3 import christie.annotation.Peek;
7a2108775da7 update paxos done
akahori
parents:
diff changeset
4 import christie.annotation.Take;
7a2108775da7 update paxos done
akahori
parents:
diff changeset
5 import christie.codegear.CodeGear;
7a2108775da7 update paxos done
akahori
parents:
diff changeset
6 import christie.codegear.CodeGearManager;
159
a0391cfdcef6 update topologymanager
akahori
parents: 157
diff changeset
7 import christie.test.topology.paxos.Proposal;
157
7a2108775da7 update paxos done
akahori
parents:
diff changeset
8
7a2108775da7 update paxos done
akahori
parents:
diff changeset
9 import java.util.HashMap;
7a2108775da7 update paxos done
akahori
parents:
diff changeset
10
7a2108775da7 update paxos done
akahori
parents:
diff changeset
11 public class RecieveAcceptProposalCodeGear extends CodeGear{
7a2108775da7 update paxos done
akahori
parents:
diff changeset
12
7a2108775da7 update paxos done
akahori
parents:
diff changeset
13 @Take
7a2108775da7 update paxos done
akahori
parents:
diff changeset
14 Proposal acceptedProposal;
7a2108775da7 update paxos done
akahori
parents:
diff changeset
15
7a2108775da7 update paxos done
akahori
parents:
diff changeset
16 @Take
7a2108775da7 update paxos done
akahori
parents:
diff changeset
17 HashMap<String, Proposal> acceptedMap;
7a2108775da7 update paxos done
akahori
parents:
diff changeset
18
7a2108775da7 update paxos done
akahori
parents:
diff changeset
19
7a2108775da7 update paxos done
akahori
parents:
diff changeset
20 @Override
7a2108775da7 update paxos done
akahori
parents:
diff changeset
21 protected void run(CodeGearManager cgm) {
181
33b4966d4d24 update paxos
akahori
parents: 159
diff changeset
22 System.out.println("accepted : " + acceptedProposal);
157
7a2108775da7 update paxos done
akahori
parents:
diff changeset
23 acceptedMap.put(acceptedProposal.getAcceptorName(),
7a2108775da7 update paxos done
akahori
parents:
diff changeset
24 acceptedProposal);
7a2108775da7 update paxos done
akahori
parents:
diff changeset
25 put("acceptedMap", acceptedMap);
159
a0391cfdcef6 update topologymanager
akahori
parents: 157
diff changeset
26 if(acceptedMap.size() > acceptedProposal.getAcceptorNum()/2) cgm.setup(new AggregateProposalCodeGear());
183
1bffd8151c6a fix paxos
akahori
parents: 181
diff changeset
27 else cgm.setup(new RecieveAcceptProposalCodeGear());
157
7a2108775da7 update paxos done
akahori
parents:
diff changeset
28 }
7a2108775da7 update paxos done
akahori
parents:
diff changeset
29 }