ManagedExecutorService
and related interfaces.@Deprecated
public interface Work
extends java.lang.Runnable
If the server is quiescing then the runtime may call the release method on the Work once it starts executing to tell it to exit. If it doesn't respond to this 'signal' then it may be terminated by the runtime without warning.
The Work is also registered with its own EventSource once it is started. The WorkItem.getEventTrigger can be used to return a proxy that can be used to fire events to the running Work. This will work whether the Work is executed locally or remotely. However, in the remote case all arguments to the event being fired must be serializable or an IllegalArgumentException is thrown.
A Work object should implement any necessary event interfaces if this mechanism is to be exploited. The WorkItem.getEventTrigger method can then be used to fire events to those interfaces. If the Work doesn't implement the interface supplied to WorkItem.getEventTrigger then nothing happens and the event is ignored.
javax.enterprise.concurrent.ManagedExecutorService
,
WorkManager
,
WorkItem
Modifier and Type | Method and Description |
---|---|
void |
release()
Deprecated.
The implementor should return from the Runnable.run method
once this is called.
|
void release()
This method can be called by the runtime when the JVM is shutting down. It should never be called directly by the application. The EventSource mechanism attached to the WorkItem should be used when the application needs to communicate with the Work after it is started. For example:
WorkItem i = wm.startWork(myWork); ... Work proxy = (Work)i.getEventTrigger(Work.class); proxy.release(); ...This is the 'safe' way to call release from an application in all cases. If an application uses the above approach then the run method should never be called on the proxy as this will almost definitely result in the application failing.