Class JobDetailImpl
- java.lang.Object
-
- org.quartz.impl.JobDetailImpl
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,JobDetail
public class JobDetailImpl extends java.lang.Object implements java.lang.Cloneable, java.io.Serializable, JobDetail
Conveys the detail properties of a given
Jobinstance.Quartz does not store an actual instance of a
Jobclass, but instead allows you to define an instance of one, through the use of aJobDetail.Jobs have a name and group associated with them, which should uniquely identify them within a single.SchedulerTriggers are the 'mechanism' by whichJobs are scheduled. ManyTriggers can point to the sameJob, but a singleTriggercan only point to oneJob.- Author:
- James House, Sharada Jambula
- See Also:
Job,StatefulJob,JobDataMap,Trigger, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description JobDetailImpl()Create aJobDetailwith no specified name or group, and the default settings of all the other properties.JobDetailImpl(java.lang.String name, java.lang.Class<? extends Job> jobClass)Deprecated.useJobBuilderJobDetailImpl(java.lang.String name, java.lang.String group, java.lang.Class<? extends Job> jobClass)Deprecated.useJobBuilderJobDetailImpl(java.lang.String name, java.lang.String group, java.lang.Class<? extends Job> jobClass, boolean durability, boolean recover)Deprecated.useJobBuilder
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectclone()booleanequals(java.lang.Object obj)java.lang.StringgetDescription()Return the description given to theJobinstance by its creator (if any).java.lang.StringgetFullName()Returns the 'full name' of theJobDetailin the format "group.name".java.lang.StringgetGroup()Get the group of thisJob.JobBuildergetJobBuilder()Get aJobBuilderthat is configured to produce aJobDetailidentical to this one.java.lang.Class<? extends Job>getJobClass()Get the instance ofJobthat will be executed.JobDataMapgetJobDataMap()Get theJobDataMapthat is associated with theJob.JobKeygetKey()java.lang.StringgetName()Get the name of thisJob.inthashCode()booleanisConcurrentExecutionDisallowed()booleanisDurable()Whether or not theJobshould remain stored after it is orphaned (nopoint to it).TriggersbooleanisPersistJobDataAfterExecution()booleanrequestsRecovery()Instructs theSchedulerwhether or not theJobshould be re-executed if a 'recovery' or 'fail-over' situation is encountered.voidsetDescription(java.lang.String description)Set a description for theJobinstance - may be useful for remembering/displaying the purpose of the job, though the description has no meaning to Quartz.voidsetDurability(boolean durability)Set whether or not theJobshould remain stored after it is orphaned (nopoint to it).TriggersvoidsetGroup(java.lang.String group)Set the group of thisJob.voidsetJobClass(java.lang.Class<? extends Job> jobClass)Set the instance ofJobthat will be executed.voidsetJobDataMap(JobDataMap jobDataMap)Set theJobDataMapto be associated with theJob.voidsetKey(JobKey key)voidsetName(java.lang.String name)Set the name of thisJob.voidsetRequestsRecovery(boolean shouldRecover)Set whether or not theSchedulershould re-execute theJobif a 'recovery' or 'fail-over' situation is encountered.java.lang.StringtoString()Return a simple string representation of this object.
-
-
-
Constructor Detail
-
JobDetailImpl
public JobDetailImpl()
Create a
JobDetailwith no specified name or group, and the default settings of all the other properties.Note that the
setName(String),setGroup(String)andsetJobClass(Class)methods must be called before the job can be placed into aScheduler
-
JobDetailImpl
@Deprecated public JobDetailImpl(java.lang.String name, java.lang.Class<? extends Job> jobClass)Deprecated.useJobBuilderCreate a
JobDetailwith the given name, given class, default group, and the default settings of all the other properties.- Throws:
java.lang.IllegalArgumentException- if name is null or empty, or the group is an empty string.
-
JobDetailImpl
@Deprecated public JobDetailImpl(java.lang.String name, java.lang.String group, java.lang.Class<? extends Job> jobClass)Deprecated.useJobBuilderCreate a
JobDetailwith the given name, group and class, and the default settings of all the other properties.- Parameters:
group- ifnull, Scheduler.DEFAULT_GROUP will be used.- Throws:
java.lang.IllegalArgumentException- if name is null or empty, or the group is an empty string.
-
JobDetailImpl
@Deprecated public JobDetailImpl(java.lang.String name, java.lang.String group, java.lang.Class<? extends Job> jobClass, boolean durability, boolean recover)Deprecated.useJobBuilderCreate a
JobDetailwith the given name, and group, and the given settings of all the other properties.- Parameters:
group- ifnull, Scheduler.DEFAULT_GROUP will be used.- Throws:
java.lang.IllegalArgumentException- if name is null or empty, or the group is an empty string.
-
-
Method Detail
-
getName
public java.lang.String getName()
Get the name of this
Job.
-
setName
public void setName(java.lang.String name)
Set the name of this
Job.- Throws:
java.lang.IllegalArgumentException- if name is null or empty.
-
getGroup
public java.lang.String getGroup()
Get the group of this
Job.
-
setGroup
public void setGroup(java.lang.String group)
Set the group of this
Job.- Parameters:
group- ifnull, Scheduler.DEFAULT_GROUP will be used.- Throws:
java.lang.IllegalArgumentException- if the group is an empty string.
-
getFullName
public java.lang.String getFullName()
Returns the 'full name' of the
JobDetailin the format "group.name".
-
setKey
public void setKey(JobKey key)
-
getDescription
public java.lang.String getDescription()
Description copied from interface:JobDetailReturn the description given to the
Jobinstance by its creator (if any).- Specified by:
getDescriptionin interfaceJobDetail- Returns:
- null if no description was set.
-
setDescription
public void setDescription(java.lang.String description)
Set a description for the
Jobinstance - may be useful for remembering/displaying the purpose of the job, though the description has no meaning to Quartz.
-
getJobClass
public java.lang.Class<? extends Job> getJobClass()
Description copied from interface:JobDetailGet the instance of
Jobthat will be executed.- Specified by:
getJobClassin interfaceJobDetail
-
setJobClass
public void setJobClass(java.lang.Class<? extends Job> jobClass)
Set the instance of
Jobthat will be executed.- Throws:
java.lang.IllegalArgumentException- if jobClass is null or the class is not aJob.
-
getJobDataMap
public JobDataMap getJobDataMap()
Description copied from interface:JobDetailGet the
JobDataMapthat is associated with theJob.- Specified by:
getJobDataMapin interfaceJobDetail
-
setJobDataMap
public void setJobDataMap(JobDataMap jobDataMap)
Set the
JobDataMapto be associated with theJob.
-
setDurability
public void setDurability(boolean durability)
Set whether or not the
Jobshould remain stored after it is orphaned (nopoint to it).TriggersIf not explicitly set, the default value is
false.
-
setRequestsRecovery
public void setRequestsRecovery(boolean shouldRecover)
Set whether or not the
Schedulershould re-execute theJobif a 'recovery' or 'fail-over' situation is encountered.If not explicitly set, the default value is
false.- See Also:
JobExecutionContext.isRecovering()
-
isDurable
public boolean isDurable()
Description copied from interface:JobDetailWhether or not the
Jobshould remain stored after it is orphaned (nopoint to it).TriggersIf not explicitly set, the default value is
false.
-
isPersistJobDataAfterExecution
public boolean isPersistJobDataAfterExecution()
- Specified by:
isPersistJobDataAfterExecutionin interfaceJobDetail- Returns:
- whether the associated Job class carries the
PersistJobDataAfterExecutionannotation. - See Also:
PersistJobDataAfterExecution
-
isConcurrentExecutionDisallowed
public boolean isConcurrentExecutionDisallowed()
- Specified by:
isConcurrentExecutionDisallowedin interfaceJobDetail- Returns:
- whether the associated Job class carries the
DisallowConcurrentExecutionannotation. - See Also:
DisallowConcurrentExecution
-
requestsRecovery
public boolean requestsRecovery()
Description copied from interface:JobDetailInstructs the
Schedulerwhether or not theJobshould be re-executed if a 'recovery' or 'fail-over' situation is encountered.If not explicitly set, the default value is
false.- Specified by:
requestsRecoveryin interfaceJobDetail- See Also:
JobExecutionContext.isRecovering()
-
toString
public java.lang.String toString()
Return a simple string representation of this object.
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
clone
public java.lang.Object clone()
-
getJobBuilder
public JobBuilder getJobBuilder()
Description copied from interface:JobDetailGet aJobBuilderthat is configured to produce aJobDetailidentical to this one.- Specified by:
getJobBuilderin interfaceJobDetail
-
-