Mercurial > hg > Database > Alice
view src/main/java/alice/test/codesegment/remote/RemoteIncrement.java @ 647:e321c5ec9b58
fix toplogy manager; ring worked
author | suruga |
---|---|
date | Sun, 31 Dec 2017 19:32:27 +0900 |
parents | 646f705e65b1 |
children |
line wrap: on
line source
package alice.test.codesegment.remote; import alice.codesegment.CodeSegment; import alice.datasegment.CommandType; import alice.datasegment.Receiver; import org.msgpack.type.ValueFactory; public class RemoteIncrement extends CodeSegment { public Receiver num = ids.create(CommandType.TAKE);//true でCompressedDSMからtake public Receiver nullValue = ids.create(CommandType.TAKE);//true でCompressedDSMからtake RemoteIncrement() { num.setKey("compressedlocal", "num"); nullValue.setKey("null-value"); } /** * Increment DataSegment value up to 10 */ @Override public void run() { String z = ""; if (num.isCompressed()){ z = "zMP"; } int num = this.num.asInteger(); if ( nullValue.getVal() == null ) { System.out.println("get null value"); } ods.put("null-value", ValueFactory.createNilValue()); System.out.println("[CodeSegment" + z + "] " + num++); if (num == 10) System.exit(0); RemoteIncrement cs = new RemoteIncrement(); if ( num % 2 == 0 ) ods.put("compressedremote", "num", num); else ods.put("remote", "num", num); cs.num.setKey("compressedlocal", "num"); } }