jakarta-eewebsphereworkmanagers

websphere work manager work timeout


From the official documentation for work manager's work timeout

Specifies the number of milliseconds to wait before attempting to release a unit of work. The timeout interval begins when the unit of work starts, rather than when the unit of work is submitted.

enter image description here

I set the work timeout to 1000 milliseconds and made sure that my thread is engaged for more than that time by calling Thread.sleep(10000). Still nothing happened or no exception was thrown. The thread was engaged for the sleep duration and was returned to pool only after that for other requests.

What does work object is released means then?


Solution

  • There is a method on the com.ibm.websphere.asynchbeans.Work interface named release. This documentation is literally referring to the work manager invoking that method on your Work implementation in response to the work timeout being reached. You can implement your release to do whatever you like, for example invoking yourWorkThread.interrupt() or setting some flag to indicate to the work that it should stop continuing to do new work.

    Here is a link to the Work API JavaDoc:

    https://www.ibm.com/support/knowledgecenter/en/SSAW57_8.5.5/com.ibm.websphere.javadoc.doc/web/apidocs/com/ibm/websphere/asynchbeans/Work.html?view=kc#release()