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]

_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to