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.
    • 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 be null 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 be null 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 be null 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 is null, 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 is null, 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.
      • getJobDefinitionJobLockByJobDefinition

        JobDefinitionJobLock getJobDefinitionJobLockByJobDefinition​(JobDefinition jobDefinition)
        Get the JobDefinitionJobLock by JobDefinitionJobLock.
        Parameters:
        jobDefinition -
        Returns:
        the JobDefinitionJobLock, or null if it could not be found
      • 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.