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

jadex.micro.testcases.threading.ProviderAgent Maven / Gradle / Ivy

Go to download

The Jadex micro applications package contains several example applications, benchmarks and testcases using micro agents.

There is a newer version: 4.0.267
Show newest version
package jadex.micro.testcases.threading;

import jadex.bridge.IComponentIdentifier;
import jadex.bridge.IInternalAccess;
import jadex.bridge.service.annotation.Service;
import jadex.commons.future.Future;
import jadex.commons.future.IFuture;
import jadex.micro.annotation.Agent;
import jadex.micro.annotation.Implementation;
import jadex.micro.annotation.ProvidedService;
import jadex.micro.annotation.ProvidedServices;


/**
 * 
 */
@Agent
@ProvidedServices(@ProvidedService(type=ITestService.class, implementation=@Implementation(expression="$pojoagent")))
@Service
public class ProviderAgent implements ITestService
{
	@Agent
	protected IInternalAccess agent;
	
	/**
	 */
	public IFuture testThreading()
	{
//		System.out.println("Provider.testThreading(): "+System.currentTimeMillis());
		
		Future ret = new Future();
		
		if(agent.getComponentIdentifier().equals(IComponentIdentifier.LOCAL.get()))
		{
			ret.setResult(null);
		}
		else
		{
			ret.setException(new RuntimeException("Not component thread: "+IComponentIdentifier.LOCAL.get()));
		}
		
		return ret;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy