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

jadex.bridge.service.component.ComponentFutureFunctionality Maven / Gradle / Ivy

Go to download

Jadex bridge is a base package for kernels and platforms, i.e., it is used by both and provides commonly used interfaces and classes for active components and their management.

There is a newer version: 4.0.267
Show newest version
package jadex.bridge.service.component;

import java.util.logging.Logger;

import jadex.bridge.ComponentResultListener;
import jadex.bridge.IInternalAccess;
import jadex.bridge.service.component.interceptors.FutureFunctionality;
import jadex.commons.ICommand;

/**
 *  Schedule forward future executions (e.g. results) on component thread,
 *  i.e. the component is the callee side of the future.
 */
public class ComponentFutureFunctionality extends FutureFunctionality
{
	//-------- attributes --------
	
	/** The adapter. */
	protected IInternalAccess	access;
	
	//-------- constructors --------
	
	/**
	 *  Create a new future.
	 */
	public ComponentFutureFunctionality(IInternalAccess access)
	{
		super((Logger)access.getLogger());
		this.access = access;
	}
	
	/**
	 *  Send a foward command.
	 */
	@Override
	public  void scheduleForward(final ICommand command, final T args)
	{
		ComponentResultListener.scheduleForward(access, null, new Runnable()
		{
			@Override
			public void run()
			{
				command.execute(args);
			}
			
			@Override
			public String toString()
			{
				return "Command(" + access + ", " + command +", " + args + ")";
			}
		});
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy