Mercurial > hg > Database > Alice
annotate src/alice/topology/manager/ConfigWaiter.java @ 35:ac3b48c5f4da
share width each other with tree
author | kazz <kazz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 20 Jan 2012 04:00:12 +0900 |
parents | |
children | 23e53aaa8720 |
rev | line source |
---|---|
35
ac3b48c5f4da
share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
1 package alice.topology.manager; |
ac3b48c5f4da
share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
2 |
ac3b48c5f4da
share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
3 import org.msgpack.type.ValueFactory; |
ac3b48c5f4da
share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
4 |
ac3b48c5f4da
share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
5 import alice.codesegment.CodeSegment; |
ac3b48c5f4da
share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
6 import alice.datasegment.CommandType; |
ac3b48c5f4da
share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
7 import alice.datasegment.Receiver; |
ac3b48c5f4da
share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
8 |
ac3b48c5f4da
share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
9 public class ConfigWaiter extends CodeSegment { |
ac3b48c5f4da
share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
10 |
ac3b48c5f4da
share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
11 public Receiver done = ids.create(CommandType.TAKE); |
ac3b48c5f4da
share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
12 public int count; |
ac3b48c5f4da
share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
13 |
ac3b48c5f4da
share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
14 public ConfigWaiter(int nodeNum) { |
ac3b48c5f4da
share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
15 this.count = nodeNum; |
ac3b48c5f4da
share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
16 } |
ac3b48c5f4da
share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
17 |
ac3b48c5f4da
share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
18 @Override |
ac3b48c5f4da
share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
19 public void run() { |
ac3b48c5f4da
share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
20 count--; |
ac3b48c5f4da
share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
21 if (count == 0) { |
ac3b48c5f4da
share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
22 ods.put("local", "start", ValueFactory.createNilValue()); |
ac3b48c5f4da
share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
23 return; |
ac3b48c5f4da
share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
24 } |
ac3b48c5f4da
share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
25 ConfigWaiter cs3 = new ConfigWaiter(count); |
ac3b48c5f4da
share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
26 cs3.done.setKey("local", "done"); |
ac3b48c5f4da
share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
27 } |
ac3b48c5f4da
share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
28 |
ac3b48c5f4da
share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
29 } |