14
|
1 package alice.test.codesegment;
|
|
2
|
|
3 import org.msgpack.type.ValueFactory;
|
|
4
|
|
5 import alice.codesegment.CodeSegment;
|
|
6 import alice.datasegment.DataSegmentValue;
|
|
7
|
|
8 public class RemoteIncrement extends CodeSegment {
|
|
9
|
|
10 @Override
|
|
11 public void run() {
|
|
12 DataSegmentValue data = ids.get("num");
|
|
13 int num = data.val.asIntegerValue().getInt();
|
|
14 System.out.println(num++);
|
|
15 if (num == 10) System.exit(0);
|
|
16
|
|
17 CodeSegment cs = new RemoteIncrement();
|
|
18 cs.ids.take("num", "remote", "num");
|
|
19 cs.ids.execute();
|
|
20
|
|
21 ods.put("local", "num", ValueFactory.createIntegerValue(num));
|
|
22 }
|
|
23
|
|
24 }
|