JBoss Community

Re: Multiple Sessions - Timer Tasks - some triggered twice and some missed

created by tmag in jBPM - View the full discussion

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 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

Start a new discussion in jBPM at Community