view src/main/java/alice/topology/node/Start.java @ 404:fee3efd9257d dispose

add node when application status running
author sugi
date Mon, 23 Jun 2014 18:12:57 +0900
parents 8f71c3e6f11d
children aefbe41fcf12
line wrap: on
line source

package alice.topology.node;

import org.apache.log4j.Logger;

import alice.codesegment.CodeSegment;
import alice.datasegment.CommandType;
import alice.datasegment.Receiver;

public class Start extends CodeSegment {
	
	public Receiver done = ids.create(CommandType.PEEK);
	public Receiver runningFlag = ids.create(CommandType.TAKE);
	
	private Logger logger = Logger.getLogger(Start.class);
	private CodeSegment startCS;

	
	public Start(CodeSegment startCS) {
		this.startCS = startCS;
	}
	
	@Override
	public void run() {
		logger.info("Configuration finished.");
		
		if (startCS == null)
			return;
		ods.update(runningFlag.key, true);
		startCS.execute();
		
	}

}