org.exolab.jms.scheduler
Class Scheduler

java.lang.Object
  |
  +--org.exolab.jms.service.Service
        |
        +--org.exolab.jms.scheduler.Scheduler
All Implemented Interfaces:
Serviceable

public class Scheduler
extends Service

The scheduler is responsible for executing Runnable objects using a thread pool. Clients can add these objects to the scheduler and the scheduler will, in fifo order, execute them. If there are no threads currently available, the runnable will wait for one to become available.

A client can add or remove Runnable objects.

Version:
$Revision: 1.3 $ $Date: 2006/02/23 11:17:39 $
Author:
Jim Mourikis, Tim Anderson, Jim Alateras

Constructor Summary
Scheduler(Configuration config, org.exolab.jms.common.threads.ThreadPoolFactory factory)
          Construct a new Scheduler.
 
Method Summary
protected  void doStop()
          Stop the service.
 void execute(java.lang.Runnable task)
          Add a Runnable object to the scheduler queue.
 
Methods inherited from class org.exolab.jms.service.Service
doStart, getName, isStarted, restart, start, stop, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Scheduler

public Scheduler(Configuration config,
                 org.exolab.jms.common.threads.ThreadPoolFactory factory)
Construct a new Scheduler.
Parameters:
config - the configuration
factory - the thread pool factory
Method Detail

execute

public void execute(java.lang.Runnable task)
             throws java.lang.InterruptedException
Add a Runnable object to the scheduler queue. When a thread becomes available, it will be executed.
Parameters:
task - the task to execute

doStop

protected void doStop()
Stop the service.
Overrides:
doStop in class Service
Following copied from class: org.exolab.jms.service.Service
Throws:
ServiceException - if the service fails to stop


Copyright © 1999-2007 The OpenJMS Group. All Rights Reserved.