public class AsyncExecutionService
extends jadex.bridge.service.BasicService
implements jadex.bridge.service.types.execution.IExecutionService
Modifier and Type | Class and Description |
---|---|
static class |
AsyncExecutionService.State
The possible states of the service.
|
Modifier and Type | Field and Description |
---|---|
protected jadex.bridge.IInternalAccess |
component
The component.
|
protected java.util.Map<jadex.commons.concurrent.IExecutable,jadex.commons.concurrent.Executor> |
executors
The currently waiting tasks (task->executor).
|
protected jadex.commons.future.Future<java.lang.Void> |
idlefuture
The idle future.
|
protected java.util.Map<jadex.commons.concurrent.IExecutable,jadex.commons.concurrent.Executor> |
runningexes
The running (i.e.
|
protected AsyncExecutionService.State |
state
The state.
|
protected jadex.bridge.service.types.threadpool.IThreadPoolService |
threadpool
The threadpool.
|
Constructor and Description |
---|
AsyncExecutionService(jadex.bridge.IInternalAccess component)
Create a new asynchronous executor service.
|
AsyncExecutionService(jadex.bridge.IInternalAccess component,
java.util.Map<java.lang.String,java.lang.Object> properties)
Create a new asynchronous executor service.
|
Modifier and Type | Method and Description |
---|---|
jadex.commons.future.IFuture<java.lang.Void> |
cancel(jadex.commons.concurrent.IExecutable task)
Cancel a task.
|
boolean |
customIsValid()
Test if the service is valid.
|
void |
execute(jadex.commons.concurrent.IExecutable task)
Execute a task in its own thread.
|
jadex.commons.future.IFuture<java.lang.Void> |
getNextIdleFuture()
Get the future indicating that executor is idle.
|
jadex.commons.concurrent.IExecutable[] |
getRunningTasks()
Get the currently running tasks.
|
jadex.commons.future.IFuture<java.lang.Void> |
shutdownService()
Shutdown the executor service.
|
jadex.commons.future.IFuture<java.lang.Void> |
startService()
Start the execution service.
|
createServiceIdentifier, createServiceIdentifier, equals, generateServiceName, getInterfaceType, getInternalAccess, getMethodTimeout, getPropertyMap, getProviderId, getServiceIdentifier, hashCode, initNFProperties, isValid, setComponentAccess, setPropertyMap, toString
protected jadex.bridge.service.types.threadpool.IThreadPoolService threadpool
protected java.util.Map<jadex.commons.concurrent.IExecutable,jadex.commons.concurrent.Executor> executors
protected jadex.commons.future.Future<java.lang.Void> idlefuture
protected AsyncExecutionService.State state
protected jadex.bridge.IInternalAccess component
protected java.util.Map<jadex.commons.concurrent.IExecutable,jadex.commons.concurrent.Executor> runningexes
public AsyncExecutionService(jadex.bridge.IInternalAccess component)
public AsyncExecutionService(jadex.bridge.IInternalAccess component, java.util.Map<java.lang.String,java.lang.Object> properties)
public void execute(jadex.commons.concurrent.IExecutable task)
execute
in interface jadex.bridge.service.types.execution.IExecutionService
task
- The task to execute.
(called from arbitrary threads)public jadex.commons.future.IFuture<java.lang.Void> cancel(jadex.commons.concurrent.IExecutable task)
cancel
in interface jadex.bridge.service.types.execution.IExecutionService
task
- The task to execute.listener
- The listener.public jadex.commons.concurrent.IExecutable[] getRunningTasks()
getRunningTasks
in interface jadex.bridge.service.types.execution.IExecutionService
public jadex.commons.future.IFuture<java.lang.Void> startService()
startService
in interface jadex.bridge.service.IInternalService
startService
in class jadex.bridge.service.BasicService
public jadex.commons.future.IFuture<java.lang.Void> shutdownService()
shutdownService
in interface jadex.bridge.service.IInternalService
shutdownService
in class jadex.bridge.service.BasicService
public boolean customIsValid()
public jadex.commons.future.IFuture<java.lang.Void> getNextIdleFuture()
getNextIdleFuture
in interface jadex.bridge.service.types.execution.IExecutionService