org.springframework.scheduling.concurrent.DefaultManagedTaskExecutor@Deprecated public class WorkManagerTaskExecutor extends org.springframework.jndi.JndiLocatorSupport implements org.springframework.core.task.AsyncListenableTaskExecutor, org.springframework.scheduling.SchedulingTaskExecutor, WorkManager, org.springframework.beans.factory.InitializingBean
WorkManager interface,
which either needs to be specified as reference or through the JNDI name.
This is the central convenience class for setting up a CommonJ WorkManager in a Spring context.
Also implements the CommonJ WorkManager interface itself, delegating all calls to the target WorkManager. Hence, a caller can choose whether it wants to talk to this executor through the Spring TaskExecutor interface or the CommonJ WorkManager interface.
The CommonJ WorkManager will usually be retrieved from the application server's JNDI environment, as defined in the server's management console.
Note: On EE 7/8 compliant versions of WebLogic and WebSphere, a
org.springframework.scheduling.concurrent.DefaultManagedTaskExecutor
should be preferred, following JSR-236 support in Java EE 7/8.
TIMEOUT_IMMEDIATE, TIMEOUT_INDEFINITEIMMEDIATE, INDEFINITE| Constructor and Description |
|---|
WorkManagerTaskExecutor()
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet()
Deprecated.
|
void |
execute(Runnable task)
Deprecated.
|
void |
execute(Runnable task,
long startTimeout)
Deprecated.
|
WorkItem |
schedule(Work work)
Deprecated.
|
WorkItem |
schedule(Work work,
WorkListener workListener)
Deprecated.
|
void |
setTaskDecorator(org.springframework.core.task.TaskDecorator taskDecorator)
Deprecated.
Specify a custom
TaskDecorator to be applied to any Runnable
about to be executed. |
void |
setWorkListener(WorkListener workListener)
Deprecated.
Specify a CommonJ WorkListener to apply, if any.
|
void |
setWorkManager(WorkManager workManager)
Deprecated.
Specify the CommonJ WorkManager to delegate to.
|
void |
setWorkManagerName(String workManagerName)
Deprecated.
Set the JNDI name of the CommonJ WorkManager.
|
<T> Future<T> |
submit(Callable<T> task)
Deprecated.
|
Future<?> |
submit(Runnable task)
Deprecated.
|
<T> org.springframework.util.concurrent.ListenableFuture<T> |
submitListenable(Callable<T> task)
Deprecated.
|
org.springframework.util.concurrent.ListenableFuture<?> |
submitListenable(Runnable task)
Deprecated.
|
boolean |
waitForAll(Collection workItems,
long timeout)
Deprecated.
|
Collection |
waitForAny(Collection workItems,
long timeout)
Deprecated.
|
convertJndiName, isResourceRef, lookup, lookup, setResourceRefgetJndiEnvironment, getJndiTemplate, setJndiEnvironment, setJndiTemplatepublic void setWorkManager(WorkManager workManager)
Alternatively, you can also specify the JNDI name of the target WorkManager.
setWorkManagerName(java.lang.String)public void setWorkManagerName(String workManagerName)
This can either be a fully qualified JNDI name, or the JNDI name relative to the current environment naming context if "resourceRef" is set to "true".
setWorkManager(commonj.work.WorkManager),
JndiLocatorSupport.setResourceRef(boolean)public void setWorkListener(WorkListener workListener)
This shared WorkListener instance will be passed on to the
WorkManager by all execute(java.lang.Runnable) calls on this TaskExecutor.
public void setTaskDecorator(org.springframework.core.task.TaskDecorator taskDecorator)
TaskDecorator to be applied to any Runnable
about to be executed.
Note that such a decorator is not necessarily being applied to the
user-supplied Runnable/Callable but rather to the actual
execution callback (which may be a wrapper around the user-supplied task).
The primary use case is to set some execution context around the task's invocation, or to provide some monitoring/statistics for task execution.
NOTE: Exception handling in TaskDecorator implementations
is limited to plain Runnable execution via execute calls.
In case of #submit calls, the exposed Runnable will be a
FutureTask which does not propagate any exceptions; you might
have to cast it and call Future#get to evaluate exceptions.
public void afterPropertiesSet()
throws NamingException
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanNamingExceptionpublic void execute(Runnable task)
public void execute(Runnable task, long startTimeout)
execute in interface org.springframework.core.task.AsyncTaskExecutorpublic Future<?> submit(Runnable task)
submit in interface org.springframework.core.task.AsyncTaskExecutorpublic <T> Future<T> submit(Callable<T> task)
submit in interface org.springframework.core.task.AsyncTaskExecutorpublic org.springframework.util.concurrent.ListenableFuture<?> submitListenable(Runnable task)
submitListenable in interface org.springframework.core.task.AsyncListenableTaskExecutorpublic <T> org.springframework.util.concurrent.ListenableFuture<T> submitListenable(Callable<T> task)
submitListenable in interface org.springframework.core.task.AsyncListenableTaskExecutorpublic WorkItem schedule(Work work) throws WorkException, IllegalArgumentException
schedule in interface WorkManagerWorkExceptionIllegalArgumentExceptionpublic WorkItem schedule(Work work, WorkListener workListener) throws WorkException
schedule in interface WorkManagerWorkExceptionpublic boolean waitForAll(Collection workItems, long timeout) throws InterruptedException
waitForAll in interface WorkManagerInterruptedExceptionpublic Collection waitForAny(Collection workItems, long timeout) throws InterruptedException
waitForAny in interface WorkManagerInterruptedException