Class StdSchedulerFactory
- java.lang.Object
-
- org.quartz.impl.StdSchedulerFactory
-
- All Implemented Interfaces:
SchedulerFactory
public class StdSchedulerFactory extends java.lang.Object implements SchedulerFactory
An implementation of
that does all of its work of creating aSchedulerFactoryQuartzSchedulerinstance based on the contents of aPropertiesfile.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 org/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 callinggetScheduler().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
,JobStore, 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.ThreadPoolOne property can reference another property's value by specifying a value following the convention of "[email protected]", for example, to reference the scheduler's instance name as the value for some other property, you would use "[email protected]".
- Author:
- James House, Anthony Eden, Mohammad Rezaei
-
-
Field Summary
-
Constructor Summary
Constructors Constructor Description StdSchedulerFactory()Create an uninitialized StdSchedulerFactory.StdSchedulerFactory(java.lang.String fileName)Create a StdSchedulerFactory that has been initialized via.initialize(String)StdSchedulerFactory(java.util.Properties props)Create a StdSchedulerFactory that has been initialized via.initialize(Properties)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Collection<Scheduler>getAllSchedulers()Returns a handle to all known Schedulers (made by any StdSchedulerFactory instance.).static SchedulergetDefaultScheduler()Returns a handle to the default Scheduler, creating it if it does not yet exist.org.slf4j.LoggergetLog()SchedulergetScheduler()Returns a handle to the Scheduler produced by this factory.SchedulergetScheduler(java.lang.String schedName)Returns a handle to the Scheduler with the given name, if it exists (if it has already been instantiated).voidinitialize()Initialize thewith the contents of aSchedulerFactoryPropertiesfile and overriding System properties.voidinitialize(java.io.InputStream propertiesStream)Initialize thewith the contents of theSchedulerFactoryPropertiesfile opened with the givenInputStream.voidinitialize(java.lang.String filename)Initialize thewith the contents of theSchedulerFactoryPropertiesfile with the given name.voidinitialize(java.util.Properties props)Initialize thewith the contents of the givenSchedulerFactoryPropertiesobject.protected Schedulerinstantiate(QuartzSchedulerResources rsrcs, QuartzScheduler qs)
-
-
-
Field Detail
-
PROPERTIES_FILE
public static final java.lang.String PROPERTIES_FILE
- See Also:
- Constant Field Values
-
PROP_SCHED_INSTANCE_NAME
public static final java.lang.String PROP_SCHED_INSTANCE_NAME
- See Also:
- Constant Field Values
-
PROP_SCHED_INSTANCE_ID
public static final java.lang.String PROP_SCHED_INSTANCE_ID
- See Also:
- Constant Field Values
-
PROP_SCHED_INSTANCE_ID_GENERATOR_PREFIX
public static final java.lang.String PROP_SCHED_INSTANCE_ID_GENERATOR_PREFIX
- See Also:
- Constant Field Values
-
PROP_SCHED_INSTANCE_ID_GENERATOR_CLASS
public static final java.lang.String PROP_SCHED_INSTANCE_ID_GENERATOR_CLASS
- See Also:
- Constant Field Values
-
PROP_SCHED_THREAD_NAME
public static final java.lang.String PROP_SCHED_THREAD_NAME
- See Also:
- Constant Field Values
-
PROP_SCHED_BATCH_TIME_WINDOW
public static final java.lang.String PROP_SCHED_BATCH_TIME_WINDOW
- See Also:
- Constant Field Values
-
PROP_SCHED_MAX_BATCH_SIZE
public static final java.lang.String PROP_SCHED_MAX_BATCH_SIZE
- See Also:
- Constant Field Values
-
PROP_SCHED_JMX_EXPORT
public static final java.lang.String PROP_SCHED_JMX_EXPORT
- See Also:
- Constant Field Values
-
PROP_SCHED_JMX_OBJECT_NAME
public static final java.lang.String PROP_SCHED_JMX_OBJECT_NAME
- See Also:
- Constant Field Values
-
PROP_SCHED_JMX_PROXY
public static final java.lang.String PROP_SCHED_JMX_PROXY
- See Also:
- Constant Field Values
-
PROP_SCHED_JMX_PROXY_CLASS
public static final java.lang.String PROP_SCHED_JMX_PROXY_CLASS
- See Also:
- Constant Field Values
-
PROP_SCHED_RMI_EXPORT
public static final java.lang.String PROP_SCHED_RMI_EXPORT
- See Also:
- Constant Field Values
-
PROP_SCHED_RMI_PROXY
public static final java.lang.String PROP_SCHED_RMI_PROXY
- See Also:
- Constant Field Values
-
PROP_SCHED_RMI_HOST
public static final java.lang.String PROP_SCHED_RMI_HOST
- See Also:
- Constant Field Values
-
PROP_SCHED_RMI_PORT
public static final java.lang.String PROP_SCHED_RMI_PORT
- See Also:
- Constant Field Values
-
PROP_SCHED_RMI_SERVER_PORT
public static final java.lang.String PROP_SCHED_RMI_SERVER_PORT
- See Also:
- Constant Field Values
-
PROP_SCHED_RMI_CREATE_REGISTRY
public static final java.lang.String PROP_SCHED_RMI_CREATE_REGISTRY
- See Also:
- Constant Field Values
-
PROP_SCHED_RMI_BIND_NAME
public static final java.lang.String PROP_SCHED_RMI_BIND_NAME
- See Also:
- Constant Field Values
-
PROP_SCHED_WRAP_JOB_IN_USER_TX
public static final java.lang.String PROP_SCHED_WRAP_JOB_IN_USER_TX
- See Also:
- Constant Field Values
-
PROP_SCHED_USER_TX_URL
public static final java.lang.String PROP_SCHED_USER_TX_URL
- See Also:
- Constant Field Values
-
PROP_SCHED_IDLE_WAIT_TIME
public static final java.lang.String PROP_SCHED_IDLE_WAIT_TIME
- See Also:
- Constant Field Values
-
PROP_SCHED_DB_FAILURE_RETRY_INTERVAL
public static final java.lang.String PROP_SCHED_DB_FAILURE_RETRY_INTERVAL
- See Also:
- Constant Field Values
-
PROP_SCHED_MAKE_SCHEDULER_THREAD_DAEMON
public static final java.lang.String PROP_SCHED_MAKE_SCHEDULER_THREAD_DAEMON
- See Also:
- Constant Field Values
-
PROP_SCHED_SCHEDULER_THREADS_INHERIT_CONTEXT_CLASS_LOADER_OF_INITIALIZING_THREAD
public static final java.lang.String PROP_SCHED_SCHEDULER_THREADS_INHERIT_CONTEXT_CLASS_LOADER_OF_INITIALIZING_THREAD
- See Also:
- Constant Field Values
-
PROP_SCHED_CLASS_LOAD_HELPER_CLASS
public static final java.lang.String PROP_SCHED_CLASS_LOAD_HELPER_CLASS
- See Also:
- Constant Field Values
-
PROP_SCHED_JOB_FACTORY_CLASS
public static final java.lang.String PROP_SCHED_JOB_FACTORY_CLASS
- See Also:
- Constant Field Values
-
PROP_SCHED_JOB_FACTORY_PREFIX
public static final java.lang.String PROP_SCHED_JOB_FACTORY_PREFIX
- See Also:
- Constant Field Values
-
PROP_SCHED_INTERRUPT_JOBS_ON_SHUTDOWN
public static final java.lang.String PROP_SCHED_INTERRUPT_JOBS_ON_SHUTDOWN
- See Also:
- Constant Field Values
-
PROP_SCHED_INTERRUPT_JOBS_ON_SHUTDOWN_WITH_WAIT
public static final java.lang.String PROP_SCHED_INTERRUPT_JOBS_ON_SHUTDOWN_WITH_WAIT
- See Also:
- Constant Field Values
-
PROP_SCHED_CONTEXT_PREFIX
public static final java.lang.String PROP_SCHED_CONTEXT_PREFIX
- See Also:
- Constant Field Values
-
PROP_THREAD_POOL_PREFIX
public static final java.lang.String PROP_THREAD_POOL_PREFIX
- See Also:
- Constant Field Values
-
PROP_THREAD_POOL_CLASS
public static final java.lang.String PROP_THREAD_POOL_CLASS
- See Also:
- Constant Field Values
-
PROP_JOB_STORE_PREFIX
public static final java.lang.String PROP_JOB_STORE_PREFIX
- See Also:
- Constant Field Values
-
PROP_JOB_STORE_LOCK_HANDLER_PREFIX
public static final java.lang.String PROP_JOB_STORE_LOCK_HANDLER_PREFIX
- See Also:
- Constant Field Values
-
PROP_JOB_STORE_LOCK_HANDLER_CLASS
public static final java.lang.String PROP_JOB_STORE_LOCK_HANDLER_CLASS
- See Also:
- Constant Field Values
-
PROP_TABLE_PREFIX
public static final java.lang.String PROP_TABLE_PREFIX
- See Also:
- Constant Field Values
-
PROP_SCHED_NAME
public static final java.lang.String PROP_SCHED_NAME
- See Also:
- Constant Field Values
-
PROP_JOB_STORE_CLASS
public static final java.lang.String PROP_JOB_STORE_CLASS
- See Also:
- Constant Field Values
-
PROP_JOB_STORE_USE_PROP
public static final java.lang.String PROP_JOB_STORE_USE_PROP
- See Also:
- Constant Field Values
-
PROP_DATASOURCE_PREFIX
public static final java.lang.String PROP_DATASOURCE_PREFIX
- See Also:
- Constant Field Values
-
PROP_CONNECTION_PROVIDER_CLASS
public static final java.lang.String PROP_CONNECTION_PROVIDER_CLASS
- See Also:
- Constant Field Values
-
PROP_DATASOURCE_DRIVER
@Deprecated public static final java.lang.String PROP_DATASOURCE_DRIVER
Deprecated.Replaced withPoolingConnectionProvider.DB_DRIVER- See Also:
- Constant Field Values
-
PROP_DATASOURCE_URL
@Deprecated public static final java.lang.String PROP_DATASOURCE_URL
Deprecated.Replaced withPoolingConnectionProvider.DB_URL- See Also:
- Constant Field Values
-
PROP_DATASOURCE_USER
@Deprecated public static final java.lang.String PROP_DATASOURCE_USER
Deprecated.Replaced withPoolingConnectionProvider.DB_USER- See Also:
- Constant Field Values
-
PROP_DATASOURCE_PASSWORD
@Deprecated public static final java.lang.String PROP_DATASOURCE_PASSWORD
Deprecated.Replaced withPoolingConnectionProvider.DB_PASSWORD- See Also:
- Constant Field Values
-
PROP_DATASOURCE_MAX_CONNECTIONS
@Deprecated public static final java.lang.String PROP_DATASOURCE_MAX_CONNECTIONS
Deprecated.Replaced withPoolingConnectionProvider.DB_MAX_CONNECTIONS- See Also:
- Constant Field Values
-
PROP_DATASOURCE_VALIDATION_QUERY
@Deprecated public static final java.lang.String PROP_DATASOURCE_VALIDATION_QUERY
Deprecated.Replaced withPoolingConnectionProvider.DB_VALIDATION_QUERY- See Also:
- Constant Field Values
-
PROP_DATASOURCE_JNDI_URL
public static final java.lang.String PROP_DATASOURCE_JNDI_URL
- See Also:
- Constant Field Values
-
PROP_DATASOURCE_JNDI_ALWAYS_LOOKUP
public static final java.lang.String PROP_DATASOURCE_JNDI_ALWAYS_LOOKUP
- See Also:
- Constant Field Values
-
PROP_DATASOURCE_JNDI_INITIAL
public static final java.lang.String PROP_DATASOURCE_JNDI_INITIAL
- See Also:
- Constant Field Values
-
PROP_DATASOURCE_JNDI_PROVIDER
public static final java.lang.String PROP_DATASOURCE_JNDI_PROVIDER
- See Also:
- Constant Field Values
-
PROP_DATASOURCE_JNDI_PRINCIPAL
public static final java.lang.String PROP_DATASOURCE_JNDI_PRINCIPAL
- See Also:
- Constant Field Values
-
PROP_DATASOURCE_JNDI_CREDENTIALS
public static final java.lang.String PROP_DATASOURCE_JNDI_CREDENTIALS
- See Also:
- Constant Field Values
-
PROP_PLUGIN_PREFIX
public static final java.lang.String PROP_PLUGIN_PREFIX
- See Also:
- Constant Field Values
-
PROP_PLUGIN_CLASS
public static final java.lang.String PROP_PLUGIN_CLASS
- See Also:
- Constant Field Values
-
PROP_JOB_LISTENER_PREFIX
public static final java.lang.String PROP_JOB_LISTENER_PREFIX
- See Also:
- Constant Field Values
-
PROP_TRIGGER_LISTENER_PREFIX
public static final java.lang.String PROP_TRIGGER_LISTENER_PREFIX
- See Also:
- Constant Field Values
-
PROP_LISTENER_CLASS
public static final java.lang.String PROP_LISTENER_CLASS
- See Also:
- Constant Field Values
-
DEFAULT_INSTANCE_ID
public static final java.lang.String DEFAULT_INSTANCE_ID
- See Also:
- Constant Field Values
-
AUTO_GENERATE_INSTANCE_ID
public static final java.lang.String AUTO_GENERATE_INSTANCE_ID
- See Also:
- Constant Field Values
-
PROP_THREAD_EXECUTOR
public static final java.lang.String PROP_THREAD_EXECUTOR
- See Also:
- Constant Field Values
-
PROP_THREAD_EXECUTOR_CLASS
public static final java.lang.String PROP_THREAD_EXECUTOR_CLASS
- See Also:
- Constant Field Values
-
SYSTEM_PROPERTY_AS_INSTANCE_ID
public static final java.lang.String SYSTEM_PROPERTY_AS_INSTANCE_ID
- See Also:
- Constant Field Values
-
MANAGEMENT_REST_SERVICE_ENABLED
public static final java.lang.String MANAGEMENT_REST_SERVICE_ENABLED
- See Also:
- Constant Field Values
-
MANAGEMENT_REST_SERVICE_HOST_PORT
public static final java.lang.String MANAGEMENT_REST_SERVICE_HOST_PORT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
StdSchedulerFactory
public StdSchedulerFactory()
Create an uninitialized StdSchedulerFactory.
-
StdSchedulerFactory
public StdSchedulerFactory(java.util.Properties props) throws SchedulerExceptionCreate a StdSchedulerFactory that has been initialized via.initialize(Properties)- Throws:
SchedulerException- See Also:
initialize(Properties)
-
StdSchedulerFactory
public StdSchedulerFactory(java.lang.String fileName) throws SchedulerExceptionCreate a StdSchedulerFactory that has been initialized via.initialize(String)- Throws:
SchedulerException- See Also:
initialize(String)
-
-
Method Detail
-
getLog
public org.slf4j.Logger getLog()
-
initialize
public void initialize() throws SchedulerExceptionInitialize the
with the contents of aSchedulerFactoryPropertiesfile 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 org/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()- Throws:
SchedulerException
-
initialize
public void initialize(java.lang.String filename) throws SchedulerExceptionInitialize the
with the contents of theSchedulerFactoryPropertiesfile with the given name.- Throws:
SchedulerException
-
initialize
public void initialize(java.io.InputStream propertiesStream) throws SchedulerExceptionInitialize the
with the contents of theSchedulerFactoryPropertiesfile opened with the givenInputStream.- Throws:
SchedulerException
-
initialize
public void initialize(java.util.Properties props)
Initialize the
with the contents of the givenSchedulerFactoryPropertiesobject.
-
instantiate
protected Scheduler instantiate(QuartzSchedulerResources rsrcs, QuartzScheduler qs)
-
getScheduler
public Scheduler getScheduler() throws SchedulerException
Returns a handle to the Scheduler produced by this factory.
If one of the
initializemethods has not be previously called, then the default (no-arg)initialize()method will be called by this method.- Specified by:
getSchedulerin interfaceSchedulerFactory- Throws:
SchedulerException- if there is a problem with the underlyingScheduler.
-
getDefaultScheduler
public static Scheduler getDefaultScheduler() throws SchedulerException
Returns a handle to the default Scheduler, creating it if it does not yet exist.
- Throws:
SchedulerException- See Also:
initialize()
-
getScheduler
public Scheduler getScheduler(java.lang.String schedName) throws SchedulerException
Returns a handle to the Scheduler with the given name, if it exists (if it has already been instantiated).
- Specified by:
getSchedulerin interfaceSchedulerFactory- Throws:
SchedulerException
-
getAllSchedulers
public java.util.Collection<Scheduler> getAllSchedulers() throws SchedulerException
Returns a handle to all known Schedulers (made by any StdSchedulerFactory instance.).
- Specified by:
getAllSchedulersin interfaceSchedulerFactory- Throws:
SchedulerException
-
-