public class StdSchedulerFactory extends Object implements ISchedulerFactory
An implementation of
that does all of its work of creating a ISchedulerFactoryQuartzScheduler instance
based on the contents of a Properties file.
By default a properties file named "quartz.properties" is loaded from the 'current working directory'. If that fails, then the "quartz.properties" file located (as a resource) in the "quartz" package is loaded. If you wish to use a file other than these defaults, you must define the system property 'org.quartz.properties' to point to the file you want.
Alternatively, you can explicitly initialize the factory by calling one of
the initialize(xx) methods before calling
getScheduler().
See the sample properties files that are distributed with Quartz for information about the various settings available within the file. Full configuration documentation can be found at http://www.quartz-scheduler.org/docs/index.html
Instances of the specified
,
IJobStore, and other SPI classes
will be created by name, and then any additional properties specified for
them in the config file will be set on the instance by calling an equivalent
'set' method. For example if the properties file contains the property
'org.quartz.jobStore.myProp = 10' then after the JobStore class has been
instantiated, the method 'setMyProp()' will be called on it. Type conversion
to primitive Java types (int, long, float, double, boolean, and String) are
performed before calling the property's setter method.
IThreadPool
One property can reference another property's value by specifying a value following the convention of "$@other.property.name", for example, to reference the scheduler's instance name as the value for some other property, you would use "$@org.quartz.scheduler.instanceName".
| Constructor and Description |
|---|
StdSchedulerFactory()
Create an uninitialized StdSchedulerFactory.
|
| Modifier and Type | Method and Description |
|---|---|
com.helger.commons.collection.impl.ICommonsCollection<IScheduler> |
getAllSchedulers()
Returns a handle to all known Schedulers (made by any StdSchedulerFactory
instance.).
|
static IScheduler |
getDefaultScheduler()
Returns a handle to the default Scheduler, creating it if it does not yet
exist.
|
IScheduler |
getScheduler()
Returns a handle to the Scheduler produced by this factory.
|
IScheduler |
getScheduler(String schedName)
Returns a handle to the Scheduler with the given name, if it exists (if it
has already been instantiated).
|
StdSchedulerFactory |
initialize()
Initialize the
with the contents of a NonBlockingProperties file and
overriding System properties. |
StdSchedulerFactory |
initialize(InputStream propertiesStream)
Initialize the
with the contents of the Properties file opened with the given
InputStream. |
StdSchedulerFactory |
initialize(com.helger.commons.lang.NonBlockingProperties props)
Initialize the
with the contents of the given Properties object. |
StdSchedulerFactory |
initialize(String filename)
Initialize the
with the contents of the Properties file with the given name. |
protected IScheduler |
instantiate(QuartzSchedulerResources rsrcs,
QuartzScheduler qs) |
public static final String PROP_PROPERTIES_FILE
public static final String PROP_SCHED_INSTANCE_NAME
public static final String PROP_SCHED_INSTANCE_ID
public static final String PROP_SCHED_INSTANCE_ID_GENERATOR_PREFIX
public static final String PROP_SCHED_INSTANCE_ID_GENERATOR_CLASS
public static final String PROP_SCHED_THREAD_NAME
public static final String PROP_SCHED_BATCH_TIME_WINDOW
public static final String PROP_SCHED_MAX_BATCH_SIZE
public static final String PROP_SCHED_IDLE_WAIT_TIME
public static final String PROP_SCHED_MAKE_SCHEDULER_THREAD_DAEMON
public static final String PROP_SCHED_SCHEDULER_THREADS_INHERIT_CONTEXT_CLASS_LOADER_OF_INITIALIZING_THREAD
public static final String PROP_SCHED_CLASS_LOAD_HELPER_CLASS
public static final String PROP_SCHED_JOB_FACTORY_CLASS
public static final String PROP_SCHED_JOB_FACTORY_PREFIX
public static final String PROP_SCHED_INTERRUPT_JOBS_ON_SHUTDOWN
public static final String PROP_SCHED_INTERRUPT_JOBS_ON_SHUTDOWN_WITH_WAIT
public static final String PROP_SCHED_CONTEXT_PREFIX
public static final String PROP_THREAD_POOL_PREFIX
public static final String PROP_THREAD_POOL_CLASS
public static final String PROP_JOB_STORE_PREFIX
public static final String PROP_JOB_STORE_LOCK_HANDLER_PREFIX
public static final String PROP_JOB_STORE_LOCK_HANDLER_CLASS
public static final String PROP_JOB_STORE_CLASS
public static final String PROP_JOB_STORE_USE_PROP
public static final String PROP_PLUGIN_PREFIX
public static final String PROP_PLUGIN_CLASS
public static final String PROP_JOB_LISTENER_PREFIX
public static final String PROP_TRIGGER_LISTENER_PREFIX
public static final String PROP_LISTENER_CLASS
public static final String DEFAULT_INSTANCE_ID
public static final String AUTO_GENERATE_INSTANCE_ID
public static final String PROP_THREAD_EXECUTOR
public static final String PROP_THREAD_EXECUTOR_CLASS
public static final String SYSTEM_PROPERTY_AS_INSTANCE_ID
public static final String DEFAULT_FILENAME
public StdSchedulerFactory()
@Nonnull public StdSchedulerFactory initialize() throws SchedulerException
Initialize the
with the contents of a ISchedulerFactoryNonBlockingProperties file and
overriding System properties.
By default a properties file named "quartz.properties" is loaded from the 'current working directory'. If that fails, then the "quartz.properties" file located (as a resource) in the "quartz" package is loaded. If you wish to use a file other than these defaults, you must define the system property 'org.quartz.properties' to point to the file you want.
System properties (environment variables, and -D definitions on the
command-line when running the JVM) override any properties in the loaded
file. For this reason, you may want to use a different initialize() method
if your application security policy prohibits access to
.
System.getProperties()
SchedulerException@Nonnull public StdSchedulerFactory initialize(String filename) throws SchedulerException
Initialize the
with the contents of the ISchedulerFactoryProperties file with the given name.
SchedulerException@Nonnull public StdSchedulerFactory initialize(@Nonnull @WillNotClose InputStream propertiesStream) throws SchedulerException
Initialize the
with the contents of the ISchedulerFactoryProperties file opened with the given
InputStream.
SchedulerException@Nonnull public StdSchedulerFactory initialize(com.helger.commons.lang.NonBlockingProperties props) throws SchedulerException
ISchedulerFactory
with the contents of the given Properties object.SchedulerException - on error@Nonnull protected IScheduler instantiate(QuartzSchedulerResources rsrcs, QuartzScheduler qs)
rsrcs - qs - public IScheduler getScheduler() throws SchedulerException
Returns a handle to the Scheduler produced by this factory.
If one of the initialize methods has not be previously called,
then the default (no-arg) initialize() method will be called
by this method.
getScheduler in interface ISchedulerFactorySchedulerException - if there is a problem with the underlying Scheduler.public static IScheduler getDefaultScheduler() throws SchedulerException
Returns a handle to the default Scheduler, creating it if it does not yet exist.
SchedulerExceptioninitialize()public IScheduler getScheduler(String schedName) throws SchedulerException
Returns a handle to the Scheduler with the given name, if it exists (if it has already been instantiated).
getScheduler in interface ISchedulerFactorySchedulerExceptionpublic com.helger.commons.collection.impl.ICommonsCollection<IScheduler> getAllSchedulers() throws SchedulerException
Returns a handle to all known Schedulers (made by any StdSchedulerFactory instance.).
getAllSchedulers in interface ISchedulerFactorySchedulerExceptionCopyright © 2016–2021 Philip Helger. All rights reserved.