annotate src/main/java/alice/test/codesegment/local/TestCodeSegment.java @ 549:9f577ff4f7ea dispose

resolve TopologyManager NullPointerException
author Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
date Tue, 06 Oct 2015 17:50:53 +0900
parents b44a2bf16eb3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
345
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
1 package alice.test.codesegment.local;
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
2
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
3 import alice.codesegment.CodeSegment;
545
074c6716f906 add AliceDeamon on paramater. not working TestLocalAlice
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents: 523
diff changeset
4 import alice.daemon.AliceDaemon;
345
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
5 import alice.datasegment.CommandType;
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
6 import alice.datasegment.Receiver;
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
7 import org.msgpack.type.Value;
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
8
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
9 public class TestCodeSegment extends CodeSegment {
419
aefbe41fcf12 change tab to space
sugi
parents: 345
diff changeset
10
aefbe41fcf12 change tab to space
sugi
parents: 345
diff changeset
11 // create input datasegment arg1
523
145c425db88d add CompressedLDSM
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents: 419
diff changeset
12 Receiver arg1 = ids.create(CommandType.PEEK);//peek用Receiverを生成
419
aefbe41fcf12 change tab to space
sugi
parents: 345
diff changeset
13
aefbe41fcf12 change tab to space
sugi
parents: 345
diff changeset
14 @Override
aefbe41fcf12 change tab to space
sugi
parents: 345
diff changeset
15 public void run() {
aefbe41fcf12 change tab to space
sugi
parents: 345
diff changeset
16 System.out.println("type = " + arg1.type);
547
e91a574b69de remove index
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents: 546
diff changeset
17 int num = arg1.asInteger();
e91a574b69de remove index
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents: 546
diff changeset
18 System.out.println("data = " + num);
419
aefbe41fcf12 change tab to space
sugi
parents: 345
diff changeset
19
547
e91a574b69de remove index
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents: 546
diff changeset
20 if (num++ == 10) {
419
aefbe41fcf12 change tab to space
sugi
parents: 345
diff changeset
21 System.exit(0);
aefbe41fcf12 change tab to space
sugi
parents: 345
diff changeset
22 return;
aefbe41fcf12 change tab to space
sugi
parents: 345
diff changeset
23 }
aefbe41fcf12 change tab to space
sugi
parents: 345
diff changeset
24
aefbe41fcf12 change tab to space
sugi
parents: 345
diff changeset
25 TestCodeSegment cs = new TestCodeSegment();
547
e91a574b69de remove index
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents: 546
diff changeset
26 cs.arg1.setKey("key1", this);//Receiverに値をpeekしてくる
419
aefbe41fcf12 change tab to space
sugi
parents: 345
diff changeset
27
aefbe41fcf12 change tab to space
sugi
parents: 345
diff changeset
28 // DataSegment.get("local").update
547
e91a574b69de remove index
Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
parents: 546
diff changeset
29 ods.update("local", "key1", num);
419
aefbe41fcf12 change tab to space
sugi
parents: 345
diff changeset
30 }
345
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
31
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
32 }