The Work interface is:
public interface Work extends Runnable
Because a JCA 1.5-compliant resource adapter deployed with the Oracle SOA will be executing in Managed Mode (that is, inside a J2EE container), it cannot create threads on its own. Rather, the adapter must rely on the WebLogic Application Server to create and start threads on its behalf.
To obtain a thread (for example, a thread to be used to poll an inbound endpoint), the adapter must submit an instance of a class implementing the Work interface to the WorkManager (which in turn is obtained via the BootstrapContext
).
The adapter does this by the run
method:
public void run()
This method is invoked by the WorkManager, using a newly allocated J2EE-compliant thread. The resource adapter can use this thread until it chooses to stop (for example, due to a unrecoverable error condition; however, this convention is not recommended) or, more appropriately, until the adapter is signalled to stop (by the release()
method):
public void release()
The adapter itself invokes release()
when it is processing the invocation of endpointDeactivation
made by the Adapter Framework.
This activity is called on a separate thread from the one currently executing the Work instance, that is, from the system thread invoking endpointActivation
.
If the resource adapter does not exit the run()
method after a preset time following the invocation of release()
, the Adapter Framework attempts to forcefully stop the thread.