[jboss-user] [JBoss jBPM] - How to stop the SchedulerThread

john.rojas do-not-reply at jboss.com
Mon Oct 16 23:02:32 EDT 2006


I have been running a java based process that uses the ScheduLerThread to execute timers.

new SchedulerThread().start()

When the process completed, the SchedulerThread would continue running indefinitely, until I read a couple of posts and came up with this solution.

I think it gets around an existing issue that prevents the SchedulerThread from being stopped by the outside application.

CODE TO START THE SchedulerThread:

  |     StoppableSchedulerThread  schedulerThread = new StoppableSchedulerThread();
  |     schedulerThread.start();
  | 

CODE TO STOP THE SchedulerThread:

  |       // Stop the scheduler thread
  |       // the SchedulerThread will stop after a few seconds
  |       schedulerThread.stopRunning();
  | 

CODE FOR StoppableSchedulerThread.java:

  | package org.jbpm.scheduler.impl;
  | 
  | public class StoppableSchedulerThread extends SchedulerThread
  | {
  |   public void stopRunning()
  |   {
  |     super.keepRunning = false;
  |   }
  | }
  | 




View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3978679#3978679

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3978679



More information about the jboss-user mailing list