Package com.redwood.scheduler.api.model
Interface JobLock
-
- All Superinterfaces:
ApplicationObject
,BusinessKeyObject
,JobLockComp
,NamedRootObject
,NamedRootObjectComp
,PartitionableObject
,PartitionableObjectComp
,Readable
,Root
,SchedulerEntity
,SchedulerEntityComp
,UniqueNamedApplicationObject
public interface JobLock extends JobLockComp, UniqueNamedApplicationObject, Readable
Locks define which jobs can and cannot run together To prevent jobs running concurrently - for example, when two or more jobs need access to the same system resource, such as a tape unit, you can define job locks. A job requests a job lock before the job is able to start; that is, before the job status can change from QUEUED to RUNNING. The job status becomes LOCKWAIT when a lock is already obtained by another job that has the status RUNNING, WAITING or CONSOLE, and the requesting job must wait. The status of the requesting job changes to RUNNING when the other job releases the lock and the requesting job gets the lock. Multiple locks can be defined for a script. Multiple locks can be used to help define which jobs can and cannot run together. For example, you have 3 jobs. Job 1 runs at 02:00. Job 2 and 3 must wait for incoming files and the completion of Job 1. You can define multiple locks on Jobs 2 and 3 so that they run only when the two conditions are met.
-
-
Field Summary
Fields Modifier and Type Field Description static Long
ALL
Value that implies that the job requires an exclusive run.static String
OBJECT_TYPE
String that will be returned fromSchedulerEntity.getObjectType()
for "JobLock" objects.static String
SEC_PRIV_CONTROL
This privilege can be granted at a group level.static String
SEC_PRIV_CREATE
This privilege can be granted at a group level.static String
SEC_PRIV_DELETE
This privilege can be granted at a group level.static String
SEC_PRIV_EDIT
This privilege can be granted at a group level.static String
SEC_PRIV_VIEW
This privilege can be granted at a group level.static String
SEC_RANK_ALL
This rank is made of the following privileges: create , view , edit , control , deletestatic String
SEC_RANK_CREATE
This rank is made of the following privileges: createstatic String
SEC_RANK_DELETE
This rank is made of the following privileges: create , view , delete , controlstatic String
SEC_RANK_EDIT
This rank is made of the following privileges: create , view , edit , controlstatic String
SEC_RANK_LOCKADMINISTRATOR
This rank is made of the following privileges: view , controlstatic String
SEC_RANK_NONE
This rank has no privileges assigned to it.static String
SEC_RANK_VIEW
This rank is made of the following privileges: viewstatic QueryObjectType<JobLock>
TYPE
Type that can be used inSchedulerSession.executeObjectQuery(QueryObjectType, String, Object...)
.static Long
UNLIMITED
Value for JobLock.MaxCount that implies that only jobs requiring JobLock.All will run exclusively.-
Fields inherited from interface com.redwood.scheduler.api.model.SchedulerEntity
ACTION_AUDIT, ACTION_EXPORT, ACTION_READ, BEHAVIOR_DEPRECATED, BEHAVIOR_NONE, BEHAVIOR_SYSTEM
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description RequiredPermission
checkControlPrivilege()
Check whether or not the control action can be performed on this object.RequiredPermission
checkCreatePrivilege()
Check whether or not the create action can be performed on this object.RequiredPermission
checkDeletePrivilege()
Check whether or not the delete action can be performed on this object.RequiredPermission
checkEditPrivilege()
Check whether or not the edit action can be performed on this object.RequiredPermission
checkViewPrivilege()
Check whether or not the view action can be performed on this object.JobChainCallJobLock
createJobChainCallJobLock(JobChainCall newJobChainCall)
Create a newJobChainCallJobLock
linked to this object.JobDefinitionJobLock
createJobDefinitionJobLock(JobDefinition newJobDefinition)
Create a newJobDefinitionJobLock
linked to this object.JobJobLock
createJobJobLock(Job newJob)
Create a newJobJobLock
linked to this object.Long
getDeprecated1()
Get the value for Deprecated1.Long
getDeprecated2()
Get the value for Deprecated2.Job
getHeldByJob()
Get the value for HeldByJob.JobChainCallJobLock
getJobChainCallJobLockByJobChainCall(JobChainCall jobChainCall)
Get the JobChainCallJobLock by JobChainCallJobLock.RWIterable<JobChainCallJobLock>
getJobChainCallJobLocks()
Get anRWIterable
over an ordered collection ofJobChainCallJobLocks
.JobDefinitionJobLock
getJobDefinitionJobLockByJobDefinition(JobDefinition jobDefinition)
Get the JobDefinitionJobLock by JobDefinitionJobLock.RWIterable<JobDefinitionJobLock>
getJobDefinitionJobLocks()
Get anRWIterable
over an ordered collection ofJobDefinitionJobLocks
.RWIterable<JobJobLock>
getJobJobLocks()
Get anRWIterable
over an ordered collection ofJobJobLocks
.LockType
getLockType()
Get the value for LockType.Long
getMaxCount()
Get the value for MaxCount.Long
getTotalInUseCount()
Get the value for TotalInUseCount.void
hold()
Hold the lock.boolean
isHeld()
Get the value for Held.boolean
isHeldByNotVisibleJob()
Get the value for HeldByNotVisibleJob.void
release()
Release the lock, such that can continue to run.void
setHeld(boolean newHeld)
Set the value for Held.void
setHeldByJob(Job newHeldByJob)
Set the value for HeldByJob.void
setLockType(LockType newLockType)
Set the value for LockType.void
setMaxCount(Long newMaxCount)
Set the value for MaxCount.-
Methods inherited from interface com.redwood.scheduler.api.model.ApplicationObject
getParentApplication, setParentApplication
-
Methods inherited from interface com.redwood.scheduler.api.model.BusinessKeyObject
getBusinessKey
-
Methods inherited from interface com.redwood.scheduler.api.model.NamedRootObject
createObjectReference, getComment, getDescription, getLinkedObjectReferenceByLinkedObject, getLinkedObjectReferenceByName, getLinkedObjectReferences, getName, getSearchName, getSourceObjectReferences, isHidden, setComment, setDescription, setName
-
Methods inherited from interface com.redwood.scheduler.api.model.PartitionableObject
createObjectTag, getEditablePartitions, getObjectTagByObjectTagDefinition, getObjectTags, getPartition, setPartition
-
Methods inherited from interface com.redwood.scheduler.api.model.Root
getCreationTime, getLastModificationTime, getLastModifierSubject
-
Methods inherited from interface com.redwood.scheduler.api.model.SchedulerEntity
canPerform, createSubjectObjectPrivilegeGrant, deleteObject, getAuditTrail, getAuditTrailSize, getBehavior, getEffectiveBehavior, getErrorNameEN, getErrorNameKey, getLLPVersion, getLOV, getLOVSupport, getObjectType, getParentSchedulerEntities, getRuntime, getSubjectObjectPrivilegeGrantBySubject, getSubjectObjectPrivilegeGrants, getUniqueId, getUrl, getUrl, isCreated, isDeletable, isDeleted, isModifiable, isModified, isSelectVersioned, processRelatedObjects, processRelatedObjects, processRelatedObjects, refreshObject, resetObject, resetObject, resetValuesToDefault, selectForRead
-
-
-
-
Field Detail
-
OBJECT_TYPE
static final String OBJECT_TYPE
String that will be returned fromSchedulerEntity.getObjectType()
for "JobLock" objects.- See Also:
- Constant Field Values
-
TYPE
static final QueryObjectType<JobLock> TYPE
Type that can be used inSchedulerSession.executeObjectQuery(QueryObjectType, String, Object...)
.
-
ALL
static final Long ALL
Value that implies that the job requires an exclusive run.
-
UNLIMITED
static final Long UNLIMITED
Value for JobLock.MaxCount that implies that only jobs requiring JobLock.All will run exclusively.
-
SEC_PRIV_CREATE
static final String SEC_PRIV_CREATE
This privilege can be granted at a group level.- See Also:
- Constant Field Values
-
SEC_PRIV_VIEW
static final String SEC_PRIV_VIEW
This privilege can be granted at a group level. This privilege can be granted at an instance level.- See Also:
- Constant Field Values
-
SEC_PRIV_EDIT
static final String SEC_PRIV_EDIT
This privilege can be granted at a group level. This privilege can be granted at an instance level.- See Also:
- Constant Field Values
-
SEC_PRIV_CONTROL
static final String SEC_PRIV_CONTROL
This privilege can be granted at a group level. This privilege can be granted at an instance level.- See Also:
- Constant Field Values
-
SEC_PRIV_DELETE
static final String SEC_PRIV_DELETE
This privilege can be granted at a group level. This privilege can be granted at an instance level.- See Also:
- Constant Field Values
-
SEC_RANK_NONE
static final String SEC_RANK_NONE
This rank has no privileges assigned to it.- See Also:
- Constant Field Values
-
SEC_RANK_CREATE
static final String SEC_RANK_CREATE
This rank is made of the following privileges: create- See Also:
- Constant Field Values
-
SEC_RANK_VIEW
static final String SEC_RANK_VIEW
This rank is made of the following privileges: view- See Also:
- Constant Field Values
-
SEC_RANK_LOCKADMINISTRATOR
static final String SEC_RANK_LOCKADMINISTRATOR
This rank is made of the following privileges: view , control- See Also:
- Constant Field Values
-
SEC_RANK_EDIT
static final String SEC_RANK_EDIT
This rank is made of the following privileges: create , view , edit , control- See Also:
- Constant Field Values
-
SEC_RANK_DELETE
static final String SEC_RANK_DELETE
This rank is made of the following privileges: create , view , delete , control- See Also:
- Constant Field Values
-
SEC_RANK_ALL
static final String SEC_RANK_ALL
This rank is made of the following privileges: create , view , edit , control , delete- See Also:
- Constant Field Values
-
-
Method Detail
-
isHeldByNotVisibleJob
boolean isHeldByNotVisibleJob()
Get the value for HeldByNotVisibleJob. ( True if the lock is held by a Job that the user is not allowed to see, false otherwise. )- Returns:
- the field
- Throws:
com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException
- This will be thrown if this method is called while the object is not attached to a session.
-
getLockType
LockType getLockType()
Get the value for LockType. (The type of lock) This value is mandatory, and therefore will not benull
if this object has been retrieved from the database.- Returns:
- the field
- Throws:
com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException
- This will be thrown if this method is called while the object is not attached to a session.
-
isHeld
boolean isHeld()
Get the value for Held. (Blocks all jobs from running if set to true)- Returns:
- the field
- Throws:
com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException
- This will be thrown if this method is called while the object is not attached to a session.
-
getMaxCount
Long getMaxCount()
Get the value for MaxCount. (The maximum number of jobs that can run with this lock.) This value is mandatory, and therefore will not benull
if this object has been retrieved from the database.- Returns:
- the field
- Throws:
com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException
- This will be thrown if this method is called while the object is not attached to a session.
-
getDeprecated1
Long getDeprecated1()
Get the value for Deprecated1. (Deprecated attribute: TotalInUseCount) This value is mandatory, and therefore will not benull
if this object has been retrieved from the database.- Returns:
- the field
- Throws:
com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException
- This will be thrown if this method is called while the object is not attached to a session.
-
getDeprecated2
Long getDeprecated2()
Get the value for Deprecated2. (Deprecated attribute: HeldByJob)- Returns:
- the field
- Throws:
com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException
- This will be thrown if this method is called while the object is not attached to a session.
-
getTotalInUseCount
Long getTotalInUseCount()
Get the value for TotalInUseCount. (The total consumed count for the running jobs on this lock.)- Returns:
- the field
- Throws:
com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException
- This will be thrown if this method is called while the object is not attached to a session.
-
getHeldByJob
Job getHeldByJob()
Get the value for HeldByJob. (The job holding a lock.)- Returns:
- the field
- Throws:
com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException
- This will be thrown if this method is called while the object is not attached to a session.
-
setLockType
void setLockType(LockType newLockType)
Set the value for LockType. (The type of lock) This value is mandatory.- Parameters:
newLockType
- the new value for LockType. If this isnull
, then the object cannot be persisted.- Throws:
com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException
- This will be thrown if this method is called while the object is not attached to a session.
-
setHeld
void setHeld(boolean newHeld)
Set the value for Held. (Blocks all jobs from running if set to true)- Parameters:
newHeld
- the new value for Held.- Throws:
com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException
- This will be thrown if this method is called while the object is not attached to a session.
-
setMaxCount
void setMaxCount(Long newMaxCount)
Set the value for MaxCount. (The maximum number of jobs that can run with this lock.) This value is mandatory.- Parameters:
newMaxCount
- the new value for MaxCount. If this isnull
, then the object cannot be persisted.- Throws:
com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException
- This will be thrown if this method is called while the object is not attached to a session.
-
setHeldByJob
void setHeldByJob(Job newHeldByJob)
Set the value for HeldByJob. (The job holding a lock.) This value is optional.- Parameters:
newHeldByJob
- the new value for HeldByJob.- Throws:
com.redwood.scheduler.api.exception.ObjectNotAttachedToSessionException
- This will be thrown if this method is called while the object is not attached to a session.
-
hold
void hold()
Hold the lock. Jobs will remain in LockWait while the lock is held.
-
release
void release()
Release the lock, such that can continue to run.
-
getJobDefinitionJobLocks
RWIterable<JobDefinitionJobLock> getJobDefinitionJobLocks()
Get anRWIterable
over an ordered collection ofJobDefinitionJobLocks
. If the collection is empty, an empty iterator will be returned, that is, this method will never returnnull
. The lock required by a job definition.- Specified by:
getJobDefinitionJobLocks
in interfaceJobLockComp
- Returns:
- An
RWIterable
over an ordered collection ofJobDefinitionJobLock
objects .
-
createJobDefinitionJobLock
JobDefinitionJobLock createJobDefinitionJobLock(JobDefinition newJobDefinition)
Create a newJobDefinitionJobLock
linked to this object.- Parameters:
newJobDefinition
- The other parent of theJobDefinitionJobLockJobDefinition
association.- Returns:
- a new
JobDefinitionJobLock
.
-
getJobDefinitionJobLockByJobDefinition
JobDefinitionJobLock getJobDefinitionJobLockByJobDefinition(JobDefinition jobDefinition)
Get the JobDefinitionJobLock by JobDefinitionJobLock.- Parameters:
jobDefinition
-- Returns:
- the JobDefinitionJobLock, or
null
if it could not be found
-
getJobJobLocks
RWIterable<JobJobLock> getJobJobLocks()
Get anRWIterable
over an ordered collection ofJobJobLocks
. If the collection is empty, an empty iterator will be returned, that is, this method will never returnnull
. The lock definitions for locks required by a job.- Specified by:
getJobJobLocks
in interfaceJobLockComp
- Returns:
- An
RWIterable
over an ordered collection ofJobJobLock
objects .
-
createJobJobLock
JobJobLock createJobJobLock(Job newJob)
Create a newJobJobLock
linked to this object.- Parameters:
newJob
- The other parent of theJobJobLockJob
association.- Returns:
- a new
JobJobLock
.
-
getJobChainCallJobLocks
RWIterable<JobChainCallJobLock> getJobChainCallJobLocks()
Get anRWIterable
over an ordered collection ofJobChainCallJobLocks
. If the collection is empty, an empty iterator will be returned, that is, this method will never returnnull
. The lock required by a job chain call.- Specified by:
getJobChainCallJobLocks
in interfaceJobLockComp
- Returns:
- An
RWIterable
over an ordered collection ofJobChainCallJobLock
objects .
-
createJobChainCallJobLock
JobChainCallJobLock createJobChainCallJobLock(JobChainCall newJobChainCall)
Create a newJobChainCallJobLock
linked to this object.- Parameters:
newJobChainCall
- The other parent of theJobChainCallJobLockJobChainCall
association.- Returns:
- a new
JobChainCallJobLock
.
-
getJobChainCallJobLockByJobChainCall
JobChainCallJobLock getJobChainCallJobLockByJobChainCall(JobChainCall jobChainCall)
Get the JobChainCallJobLock by JobChainCallJobLock.- Parameters:
jobChainCall
-- Returns:
- the JobChainCallJobLock, or
null
if it could not be found
-
checkCreatePrivilege
RequiredPermission checkCreatePrivilege()
Check whether or not the create action can be performed on this object.- Returns:
- a
RequiredPermission
instance indicating whether the current user has the privilege. To check this, use isAllowed() on the returned permission.
-
checkViewPrivilege
RequiredPermission checkViewPrivilege()
Check whether or not the view action can be performed on this object.- Returns:
- a
RequiredPermission
instance indicating whether the current user has the privilege. To check this, use isAllowed() on the returned permission.
-
checkEditPrivilege
RequiredPermission checkEditPrivilege()
Check whether or not the edit action can be performed on this object.- Returns:
- a
RequiredPermission
instance indicating whether the current user has the privilege. To check this, use isAllowed() on the returned permission.
-
checkControlPrivilege
RequiredPermission checkControlPrivilege()
Check whether or not the control action can be performed on this object.- Returns:
- a
RequiredPermission
instance indicating whether the current user has the privilege. To check this, use isAllowed() on the returned permission.
-
checkDeletePrivilege
RequiredPermission checkDeletePrivilege()
Check whether or not the delete action can be performed on this object.- Returns:
- a
RequiredPermission
instance indicating whether the current user has the privilege. To check this, use isAllowed() on the returned permission.
-
-