annotate src/alice/topology/node/Start.java @ 45:ae24d5d40c10

add to calculate the time of RingTopology required
author kazz <kazz@cr.ie.u-ryukyu.ac.jp>
date Sat, 04 Feb 2012 14:31:07 +0900
parents ac3b48c5f4da
children 1a498f436332
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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.node;
ac3b48c5f4da share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2
45
ae24d5d40c10 add to calculate the time of RingTopology required
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 35
diff changeset
3 import org.apache.log4j.Logger;
ae24d5d40c10 add to calculate the time of RingTopology required
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 35
diff changeset
4
35
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 Start 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.PEEK);
45
ae24d5d40c10 add to calculate the time of RingTopology required
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 35
diff changeset
12 private Logger logger = Logger.getLogger(Start.class);
35
ac3b48c5f4da share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 private Class<? extends CodeSegment> clazz;
ac3b48c5f4da share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14
ac3b48c5f4da share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 public Start(Class<? extends CodeSegment> clazz) {
ac3b48c5f4da share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 this.clazz = clazz;
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
ac3b48c5f4da share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 @Override
ac3b48c5f4da share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 public void run() {
45
ae24d5d40c10 add to calculate the time of RingTopology required
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 35
diff changeset
21 logger.info("Configuration finished.");
35
ac3b48c5f4da share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 if (clazz == null)
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 try {
ac3b48c5f4da share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 clazz.newInstance().execute();
ac3b48c5f4da share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 } catch (InstantiationException e) {
ac3b48c5f4da share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 e.printStackTrace();
ac3b48c5f4da share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 } catch (IllegalAccessException e) {
ac3b48c5f4da share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 e.printStackTrace();
ac3b48c5f4da share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 }
ac3b48c5f4da share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
31
ac3b48c5f4da share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 }
ac3b48c5f4da share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
33
ac3b48c5f4da share width each other with tree
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
34 }