[jboss-user] [jBPM] - Re: Multiple Sessions - Timer Tasks - some triggered twice and some missed
tmag
do-not-reply at jboss.com
Fri Jan 18 10:36:40 EST 2013
tmag [https://community.jboss.org/people/tmag] created the discussion
"Re: Multiple Sessions - Timer Tasks - some triggered twice and some missed"
To view the discussion, visit: https://community.jboss.org/message/792814#792814
--------------------------------------------------------------
Debugging the code - it seems +*SchedulerThreadPool*+ in +*JDKTimerService*+ is getting instantiated multiple times for some sessions and jobs getting scheduled twice.
As a work around we registered our own +*TimerService*+ and made this +*SchedulerThreadPool*+ static to get instanatiated only once (one SchedulerThreadPool per JVM) & made the pool size configurable.
Refer to https://community.jboss.org/message/741461#741461 https://community.jboss.org/message/741461 to register your own timer service.
private static ScheduledThreadPoolExecutor scheduler;
..........................................
public MyTimerService(int size) {
getSchedularInstance(size);
}
private ScheduledThreadPoolExecutor getSchedularInstance(int size) {
if(scheduler == null) {
this.scheduler = new ScheduledThreadPoolExecutor( size );
} else {
System.out.println(" returning the old scheduler ...");
}
return this.scheduler;
}
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/792814#792814]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20130118/1d117d05/attachment.html
More information about the jboss-user
mailing list