Package jadex.micro.taskdistributor
Class TaskDistributorAgent<R,T>
java.lang.Object
jadex.micro.taskdistributor.TaskDistributorAgent<R,T>
- All Implemented Interfaces:
ITaskDistributor<R,T>
-
Nested Class Summary
Nested classes/interfaces inherited from interface jadex.micro.taskdistributor.ITaskDistributor
ITaskDistributor.Task<T> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected Queue<jadex.future.Future<ITaskDistributor.Task<T>>> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionjadex.future.IFuture<R> Publish a new task.jadex.future.IFuture<ITaskDistributor.Task<T>> Request a task.jadex.future.IFuture<Void> setTaskException(String id, Exception ex) Set the exception of a task.jadex.future.IFuture<Void> setTaskResult(String id, R result) Set the result of a task.
-
Field Details
-
tasks
-
requestors
-
ongoingtasks
-
cnt
protected int cnt
-
-
Constructor Details
-
TaskDistributorAgent
public TaskDistributorAgent()
-
-
Method Details
-
publish
Publish a new task.- Specified by:
publishin interfaceITaskDistributor<R,T> - Parameters:
task- The task to publish.
-
setTaskResult
Set the result of a task.- Specified by:
setTaskResultin interfaceITaskDistributor<R,T> - Parameters:
id- The task id.result- The result.
-
setTaskException
Set the exception of a task.- Specified by:
setTaskExceptionin interfaceITaskDistributor<R,T> - Parameters:
id- The task id.ex- The exception.
-
requestNextTask
Request a task.- Specified by:
requestNextTaskin interfaceITaskDistributor<R,T> - Returns:
- The next task (waits for a task).
-