view src/main/java/alice/test/codesegment/remote/RemoteIncrement1.java @ 654:2fbd6ac705df

fix
author suruga
date Fri, 09 Feb 2018 19:48:43 +0900
parents e321c5ec9b58
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 RemoteIncrement1 extends CodeSegment {

    public Receiver num = ids.create(CommandType.TAKE);
    public Receiver nullValue = ids.create(CommandType.TAKE);

    RemoteIncrement1() {
        num.setKey("remote","num2");
        nullValue.setKey("remote","remote-null-value");
    }

    /**
     * Increment DataSegment value up to 10
     */
    @Override
    public void run() {

        int num = this.num.asInteger();
        System.out.println("remote " + num++);
        if (num == 5) {
            ods.finish("remote");
            ods.finish("local");
            return;
        }
        if ( nullValue.getVal() == null ) {
            System.out.println("get remote null value");
        }

        ods.put("remote","remote-null-value", ValueFactory.createNilValue());

        new RemoteIncrement1();
        ods.put("remote", "num2", num);
    }

}