Home » quartz-1.6.0 » org » quartz » impl » [javadoc | source]
org.quartz.impl
public class: DirectSchedulerFactory [javadoc | source]
java.lang.Object
   org.quartz.impl.DirectSchedulerFactory

All Implemented Interfaces:
    SchedulerFactory

A singleton implementation of org.quartz.SchedulerFactory .

Here are some examples of using this class:

To create a scheduler that does not write anything to the database (is not persistent), you can call createVolatileScheduler:

DirectSchedulerFactory.getInstance().createVolatileScheduler(10); // 10 threads * // don't forget to start the scheduler: DirectSchedulerFactory.getInstance().getScheduler().start();

Several create methods are provided for convenience. All create methods eventually end up calling the create method with all the parameters:

public void createScheduler(String schedulerName, String schedulerInstanceId, ThreadPool threadPool, JobStore jobStore, String rmiRegistryHost, int rmiRegistryPort)

Here is an example of using this method:

* *
// create the thread pool SimpleThreadPool threadPool = new SimpleThreadPool(maxThreads, Thread.NORM_PRIORITY); threadPool.initialize(); * // create the job store JobStore jobStore = new RAMJobStore(); jobStore.initialize();

DirectSchedulerFactory.getInstance().createScheduler("My Quartz Scheduler", "My Instance", threadPool, jobStore, "localhost", 1099); * // don't forget to start the scheduler: DirectSchedulerFactory.getInstance().getScheduler("My Quartz Scheduler", "My Instance").start();

You can also use a JDBCJobStore instead of the RAMJobStore:

DBConnectionManager.getInstance().addConnectionProvider("someDatasource", new JNDIConnectionProvider("someDatasourceJNDIName"));

JDBCJobStore jdbcJobStore = new JDBCJobStore(); jdbcJobStore.setDataSource("someDatasource"); jdbcJobStore.setPostgresStyleBlobs(true); jdbcJobStore.setTablePrefix("QRTZ_"); jdbcJobStore.setInstanceId("My Instance"); jdbcJobStore.initialize();
Field Summary
public static final  String DEFAULT_INSTANCE_ID     
public static final  String DEFAULT_SCHEDULER_NAME     
Constructor:
 protected DirectSchedulerFactory() 
Method from org.quartz.impl.DirectSchedulerFactory Summary:
createRemoteScheduler,   createRemoteScheduler,   createRemoteScheduler,   createScheduler,   createScheduler,   createScheduler,   createScheduler,   createVolatileSchduler,   createVolatileScheduler,   getAllSchedulers,   getInstance,   getLog,   getScheduler,   getScheduler
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.quartz.impl.DirectSchedulerFactory Detail:
 public  void createRemoteScheduler(String rmiHost,
    int rmiPort) throws SchedulerException 
 public  void createRemoteScheduler(String schedulerName,
    String schedulerInstanceId,
    String rmiHost,
    int rmiPort) throws SchedulerException 
 public  void createRemoteScheduler(String schedulerName,
    String schedulerInstanceId,
    String rmiBindName,
    String rmiHost,
    int rmiPort) throws SchedulerException 
 public  void createScheduler(ThreadPool threadPool,
    JobStore jobStore) throws SchedulerException 
 public  void createScheduler(String schedulerName,
    String schedulerInstanceId,
    ThreadPool threadPool,
    JobStore jobStore) throws SchedulerException 
 public  void createScheduler(String schedulerName,
    String schedulerInstanceId,
    ThreadPool threadPool,
    JobStore jobStore,
    String rmiRegistryHost,
    int rmiRegistryPort,
    long idleWaitTime,
    long dbFailureRetryInterval) throws SchedulerException 
    Creates a scheduler using the specified thread pool and job store and binds it to RMI.
 public  void createScheduler(String schedulerName,
    String schedulerInstanceId,
    ThreadPool threadPool,
    JobStore jobStore,
    Map schedulerPluginMap,
    String rmiRegistryHost,
    int rmiRegistryPort,
    long idleWaitTime,
    long dbFailureRetryInterval) throws SchedulerException 
    Creates a scheduler using the specified thread pool, job store, and plugins, and binds it to RMI.
 public  void createVolatileSchduler(int maxThreads) throws SchedulerException 
Deprecated! see - correctly spelled method.

 public  void createVolatileScheduler(int maxThreads) throws SchedulerException 
    Creates an in memory job store (RAMJobStore ) The thread priority is set to Thread.NORM_PRIORITY
 public Collection getAllSchedulers() throws SchedulerException 

    Returns a handle to all known Schedulers (made by any StdSchedulerFactory instance.).

 public static DirectSchedulerFactory getInstance() 
 protected Log getLog() 
 public Scheduler getScheduler() throws SchedulerException 

    Returns a handle to the Scheduler produced by this factory.

    you must call createRemoteScheduler or createScheduler methods before calling getScheduler()

 public Scheduler getScheduler(String schedName) throws SchedulerException 

    Returns a handle to the Scheduler with the given name, if it exists.