Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.distributeme.agents;
 
public enum AgencyImpl implements Agency{
	INSTANCE;
	private static Logger log = LoggerFactory.getLogger(AgencyImpl.class);
	public void receiveAndAwakeAgent(AgentPackage agentpackagethrows AgencyException {
			.debug("Incoming agent "+agentpackage);
		final Agent agent = AgentPackageUtility.unpack(agentpackage);
		//System.out.println("unpacked agent "+agent);
		Thread agentThread = new Thread(new AgentRunnable(agent), "Agent "+agent.toString());
		agentThread.start();
	}
	class AgentRunnable implements Runnable{
		private Agent agent;
		public AgentRunnable(Agent toRun) {
			 = toRun;
		}
		public void run(){
		}
	}
	public void sendAgent(Agent agentServiceDescriptor destination)
			throws AgencyException {
		try{
			ServiceDescriptor target = destination.changeServiceId(TransporterServiceConstants.getServiceId());
			..println("Sending agent "+agent+" to "+target);
			TransporterService transporter = new RemoteTransporterServiceStub(target);
			transporter.receiveAndAwakeAgent(AgentPackageUtility.pack(agent));
			throw new AgencyException("sendAgent("+agent+", "+destination+")"e);
		}
	}
New to GrepCode? Check out our FAQ X