I've got the below code working on Weblogic Application Server 10.3.2. The long running task executed on timerExpired takes longer than the server wide StuckThreadMaxTime of 600 seconds. I do not want to modify this value, but just to ignore the stuck thread timeout for this particular thread of processing.
I can see how this can be accomplished using a commonj WorkManager from this: http://download.oracle.com/docs/cd/E11035_01/wls100/config_wls/self_tuned.html#wp1069945
And then by adding the following to the work-manager tag in the weblogic.xml file:
<ignore-stuck-threads>true</ignore-stuck-threads>
But how on earth do I do the same for a Timer/TimerManager?
web.xml
<resource-ref>
<res-ref-name>tm/TestTimer</res-ref-name>
<res-type>commonj.timers.TimerManager</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Unshareable</res-sharing-scope>
</resource-ref>
TestTimer.java:
import commonj.timers.Timer;
import commonj.timers.TimerListener;
import commonj.timers.TimerManager;
public class TestTimer implements TimerListener {
public void init()
TimerManager timerManager =
(TimerManager)initContext.lookup("java:comp/env/tm/TestTimer");
timerManager.schedule(this, SCHEDULE_DELAY);
}
@Override
public void timerExpired(Timer timer) {
// perform long-running task
}
}
I took the easy way out (time pressures) by doing the processing in work scheduled by a WorkManager when the timer expires.
web.xml
weblogic.xml