Package org.quartz.simpl
Class SystemPropertyInstanceIdGenerator
- java.lang.Object
-
- org.quartz.simpl.SystemPropertyInstanceIdGenerator
-
- All Implemented Interfaces:
InstanceIdGenerator
public class SystemPropertyInstanceIdGenerator extends java.lang.Object implements InstanceIdGenerator
InstanceIdGenerator that will use asystem propertyto configure the scheduler. The default system property name to use the value ofSYSTEM_PROPERTY, but can be specified via the "systemPropertyName" property. You can also set the properties "postpend" and "prepend" to String values that will be added to the beginning or end (respectively) of the value found in the system property. If no value set for the property, aSchedulerExceptionis thrown- Author:
- Alex Snaps
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringSYSTEM_PROPERTYSystem property to read the instanceId from
-
Constructor Summary
Constructors Constructor Description SystemPropertyInstanceIdGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgenerateInstanceId()Returns the cluster wide value for this scheduler instance's id, based on a system propertyjava.lang.StringgetPostpend()A String of text to postpend (add to the end) to the instanceId found in the system property.java.lang.StringgetPrepend()A String of text to prepend (add to the beginning) to the instanceId found in the system property.java.lang.StringgetSystemPropertyName()The name of the system property from which to obtain the instanceId.voidsetPostpend(java.lang.String postpend)A String of text to postpend (add to the end) to the instanceId found in the system property.voidsetPrepend(java.lang.String prepend)A String of text to prepend (add to the beginning) to the instanceId found in the system property.voidsetSystemPropertyName(java.lang.String systemPropertyName)The name of the system property from which to obtain the instanceId.
-
-
-
Field Detail
-
SYSTEM_PROPERTY
public static final java.lang.String SYSTEM_PROPERTY
System property to read the instanceId from- See Also:
- Constant Field Values
-
-
Method Detail
-
generateInstanceId
public java.lang.String generateInstanceId() throws SchedulerExceptionReturns the cluster wide value for this scheduler instance's id, based on a system property- Specified by:
generateInstanceIdin interfaceInstanceIdGenerator- Returns:
- the value of the system property named by the value of
getSystemPropertyName()- which defaults toSYSTEM_PROPERTY. - Throws:
SchedulerException- Shouldn't a value be found
-
getPrepend
public java.lang.String getPrepend()
A String of text to prepend (add to the beginning) to the instanceId found in the system property.
-
setPrepend
public void setPrepend(java.lang.String prepend)
A String of text to prepend (add to the beginning) to the instanceId found in the system property.- Parameters:
prepend- the value to prepend, or null if none is desired.
-
getPostpend
public java.lang.String getPostpend()
A String of text to postpend (add to the end) to the instanceId found in the system property.
-
setPostpend
public void setPostpend(java.lang.String postpend)
A String of text to postpend (add to the end) to the instanceId found in the system property.- Parameters:
postpend- the value to postpend, or null if none is desired.
-
getSystemPropertyName
public java.lang.String getSystemPropertyName()
The name of the system property from which to obtain the instanceId. Defaults toSYSTEM_PROPERTY.
-
setSystemPropertyName
public void setSystemPropertyName(java.lang.String systemPropertyName)
The name of the system property from which to obtain the instanceId. Defaults toSYSTEM_PROPERTY.- Parameters:
systemPropertyName- the system property name
-
-