All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.distributeme.agents.operatives.HelloWorldAgent2 Maven / Gradle / Ivy

There is a newer version: 4.0.2
Show newest version
package org.distributeme.agents.operatives;

import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Logger;
import org.distributeme.agents.AgencyImpl;
import org.distributeme.agents.Agent;
import org.distributeme.core.ServiceDescriptor;

/**
 * This agent will move into given destination vm and print out a HelloWorld to SysOut.
 * @author lrosenberg
 *
 */
public class HelloWorldAgent2 implements Agent{

	static{
		BasicConfigurator.configure();
		
	}
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Override
	public void prepareForTransport() {
		System.out.println("Going to move now!");
	}

	@Override
	public void awake() {
		System.out.println("Good bye World");
	}

	
	public static void main(String[] args) throws Exception{
		BasicConfigurator.configure();
		Logger.getLogger(HelloWorldAgent2.class).info("TEST");
		System.out.println("Creating agent");
		String target = "rmi://org_distributeme_test_echo_EchoService.lfxyotkpcy@192.168.200.101:9250@20110817012752";
		if (args.length!=1){
			//return later
		}else{
			target = args[0];
		}
		
		System.out.println("Trying to send agent to "+target);
		HelloWorldAgent2 agent = new HelloWorldAgent2();
		AgencyImpl.INSTANCE.sendAgent(agent, ServiceDescriptor.fromSystemWideUniqueId(target));
		System.out.println("done");
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy