org.quartz.impl
Class JobDetailImpl

java.lang.Object
  extended by 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 Job instance.

Quartz does not store an actual instance of a Job class, but instead allows you to define an instance of one, through the use of a JobDetail.

Jobs have a name and group associated with them, which should uniquely identify them within a single Scheduler.

Triggers are the 'mechanism' by which Jobs are scheduled. Many Triggers can point to the same Job, but a single Trigger can only point to one Job.

Author:
James House, Sharada Jambula
See Also:
Job, StatefulJob, JobDataMap, Trigger, Serialized Form

Constructor Summary
JobDetailImpl()
           Create a JobDetail with 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. use JobBuilder
JobDetailImpl(java.lang.String name, java.lang.String group, java.lang.Class<? extends Job> jobClass)
          Deprecated. use JobBuilder
JobDetailImpl(java.lang.String name, java.lang.String group, java.lang.Class<? extends Job> jobClass, boolean durability, boolean recover)
          Deprecated. use JobBuilder
 
Method Summary
 java.lang.Object clone()
           
 boolean equals(java.lang.Object obj)
           
 java.lang.String getDescription()
           Return the description given to the Job instance by its creator (if any).
 java.lang.String getFullName()
           Returns the 'full name' of the JobDetail in the format "group.name".
 java.lang.String getGroup()
           Get the group of this Job.
 JobBuilder getJobBuilder()
          Get a JobBuilder that is configured to produce a JobDetail identical to this one.
 java.lang.Class<? extends Job> getJobClass()
           Get the instance of Job that will be executed.
 JobDataMap getJobDataMap()
           Get the JobDataMap that is associated with the Job.
 JobKey getKey()
           
 java.lang.String getName()
           Get the name of this Job.
 int hashCode()
           
 boolean isConcurrentExectionDisallowed()
           
 boolean isDurable()
           Whether or not the Job should remain stored after it is orphaned (no Triggers point to it).
 boolean isPersistJobDataAfterExecution()
           
 boolean requestsRecovery()
           Instructs the Scheduler whether or not the Job should be re-executed if a 'recovery' or 'fail-over' situation is encountered.
 void setDescription(java.lang.String description)
           Set a description for the Job instance - may be useful for remembering/displaying the purpose of the job, though the description has no meaning to Quartz.
 void setDurability(boolean durability)
           Set whether or not the Job should remain stored after it is orphaned (no Triggers point to it).
 void setGroup(java.lang.String group)
           Set the group of this Job.
 void setJobClass(java.lang.Class<? extends Job> jobClass)
           Set the instance of Job that will be executed.
 void setJobDataMap(JobDataMap jobDataMap)
           Set the JobDataMap to be associated with the Job.
 void setKey(JobKey key)
           
 void setName(java.lang.String name)
           Set the name of this Job.
 void setRequestsRecovery(boolean shouldRecover)
           Set whether or not the the Scheduler should re-execute the Job if a 'recovery' or 'fail-over' situation is encountered.
 java.lang.String toString()
           Return a simple string representation of this object.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JobDetailImpl

public JobDetailImpl()

Create a JobDetail with no specified name or group, and the default settings of all the other properties.

Note that the setName(String),setGroup(String)and setJobClass(Class)methods must be called before the job can be placed into a Scheduler


JobDetailImpl

public JobDetailImpl(java.lang.String name,
                     java.lang.Class<? extends Job> jobClass)
Deprecated. use JobBuilder

Create a JobDetail with the given name, given class, default group, and the default settings of all the other properties.

Parameters:
group - if null, Scheduler.DEFAULT_GROUP will be used.
Throws:
java.lang.IllegalArgumentException - if name is null or empty, or the group is an empty string.

JobDetailImpl

public JobDetailImpl(java.lang.String name,
                     java.lang.String group,
                     java.lang.Class<? extends Job> jobClass)
Deprecated. use JobBuilder

Create a JobDetail with the given name, group and class, and the default settings of all the other properties.

Parameters:
group - if null, Scheduler.DEFAULT_GROUP will be used.
Throws:
java.lang.IllegalArgumentException - if name is null or empty, or the group is an empty string.

JobDetailImpl

public JobDetailImpl(java.lang.String name,
                     java.lang.String group,
                     java.lang.Class<? extends Job> jobClass,
                     boolean durability,
                     boolean recover)
Deprecated. use JobBuilder

Create a JobDetail with the given name, and group, and the given settings of all the other properties.

Parameters:
group - if null, 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 - if null, 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 JobDetail in the format "group.name".


getKey

public JobKey getKey()
Specified by:
getKey in interface JobDetail

setKey

public void setKey(JobKey key)

getDescription

public java.lang.String getDescription()
Description copied from interface: JobDetail

Return the description given to the Job instance by its creator (if any).

Specified by:
getDescription in interface JobDetail
Returns:
null if no description was set.

setDescription

public void setDescription(java.lang.String description)

Set a description for the Job instance - 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: JobDetail

Get the instance of Job that will be executed.

Specified by:
getJobClass in interface JobDetail

setJobClass

public void setJobClass(java.lang.Class<? extends Job> jobClass)

Set the instance of Job that will be executed.

Throws:
java.lang.IllegalArgumentException - if jobClass is null or the class is not a Job.

getJobDataMap

public JobDataMap getJobDataMap()
Description copied from interface: JobDetail

Get the JobDataMap that is associated with the Job.

Specified by:
getJobDataMap in interface JobDetail

setJobDataMap

public void setJobDataMap(JobDataMap jobDataMap)

Set the JobDataMap to be associated with the Job.


setDurability

public void setDurability(boolean durability)

Set whether or not the Job should remain stored after it is orphaned (no Triggers point to it).

If not explicitly set, the default value is false.


setRequestsRecovery

public void setRequestsRecovery(boolean shouldRecover)

Set whether or not the the Scheduler should re-execute the Job if 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: JobDetail

Whether or not the Job should remain stored after it is orphaned (no Triggers point to it).

If not explicitly set, the default value is false.

Specified by:
isDurable in interface JobDetail
Returns:
true if the Job should remain persisted after being orphaned.

isPersistJobDataAfterExecution

public boolean isPersistJobDataAfterExecution()
Specified by:
isPersistJobDataAfterExecution in interface JobDetail
Returns:
whether the associated Job class carries the PersistJobDataAfterExecution annotation.
See Also:
PersistJobDataAfterExecution

isConcurrentExectionDisallowed

public boolean isConcurrentExectionDisallowed()
Specified by:
isConcurrentExectionDisallowed in interface JobDetail
Returns:
whether the associated Job class carries the DisallowConcurrentExecution annotation.
See Also:
DisallowConcurrentExecution

requestsRecovery

public boolean requestsRecovery()
Description copied from interface: JobDetail

Instructs the Scheduler whether or not the Job should be re-executed if a 'recovery' or 'fail-over' situation is encountered.

If not explicitly set, the default value is false.

Specified by:
requestsRecovery in interface JobDetail
See Also:
JobExecutionContext.isRecovering()

toString

public java.lang.String toString()

Return a simple string representation of this object.

Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

clone

public java.lang.Object clone()
Specified by:
clone in interface JobDetail
Overrides:
clone in class java.lang.Object

getJobBuilder

public JobBuilder getJobBuilder()
Description copied from interface: JobDetail
Get a JobBuilder that is configured to produce a JobDetail identical to this one.

Specified by:
getJobBuilder in interface JobDetail


Copyright 2001-2019, Terracotta, Inc.