Class JobQueue

java.lang.Object
overit.geocall.scheduler.JobQueue
All Implemented Interfaces:
overit.geocall.marks.FieldExposer
Direct Known Subclasses:
JobQueueFixedDelay, JobQueueFixedRate, JobQueueFixedTime

public abstract class JobQueue extends Object implements overit.geocall.marks.FieldExposer
This class implements the queue of Job
  • Field Details

    • LOG

      public static final LogChannel LOG
    • _jobQueues

      protected static HashMap _jobQueues
    • FIXED_RATE

      public static final int FIXED_RATE
      See Also:
    • FIXED_DELAY

      public static final int FIXED_DELAY
      See Also:
    • FIXED_TIME

      public static final int FIXED_TIME
      See Also:
    • STATE_STOPPED

      public static final int STATE_STOPPED
      See Also:
    • STATE_RUNNING

      public static final int STATE_RUNNING
      See Also:
    • _TIMEUNIT

      protected static int _TIMEUNIT
    • _qr

      protected JobQueue.QueueRunner _qr
    • _weekDays

      protected Set _weekDays
    • _monthDays

      protected Set _monthDays
    • _dayHours

      protected Set _dayHours
    • _hourMinutes

      protected Set _hourMinutes
    • _runningJob

      protected String _runningJob
    • _t

      protected Timer _t
    • _name

      protected String _name
    • _description

      protected String _description
    • _schedulingDate

      protected Date _schedulingDate
    • _state

      protected int _state
    • _at

      protected Date _at
    • _period

      protected int _period
    • _random

      protected int _random
    • _jobs

      protected ArrayList _jobs
  • Constructor Details

    • JobQueue

      protected JobQueue()
    • JobQueue

      public JobQueue(String name, String description, int state)
      Creates a new JobQueue
      Parameters:
      name - The name of the JobQueue
      description - The description of the JobQueue
      state - The state of the JobQueue
  • Method Details

    • getJobQueue

      public static JobQueue getJobQueue(String name)
      Returns the JobQueue with a given name
      Parameters:
      name - The name to search
      Returns:
      The JobQueue
    • removeJobQueue

      public static void removeJobQueue(JobQueue jq)
      Removes the JobQueue
      Parameters:
      jq - The JobQueue
    • queueIterator

      public static Iterator queueIterator()
      Returns the Iterator for the JobQueue
      Returns:
      The Iterator for the JobQueue
    • getWeekDays

      public Set getWeekDays()
      Returns the Set of week days
      Returns:
      The Set of week days
    • getMonthDays

      public Set getMonthDays()
      Returns the Set of month days
      Returns:
      The Set of month days
    • getDayHours

      public Set getDayHours()
      Returns the Set of day hours
      Returns:
      The Set of day hours
    • getHourMinutes

      public Set getHourMinutes()
      Returns the Set of hour minutes
      Returns:
      The Set of hour minutes
    • staticInt

      public static int staticInt(String name, int def)
      Returns the static int
      Parameters:
      name - The name of the field
      def - The default value
      Returns:
      The static int of the class with the corrisponding name, if not found returns def
    • schedule

      public void schedule(Date at, int period, int random, Set hourMinutes, Set dayHours, Set weekDays, Set monthDays)
      Schedule a JobQUeue
      Parameters:
      at - The Date
      period - The period
      random - The random
      hourMinutes - The set with hour minutes
      dayHours - The set with day hours
      weekDays - The set with week days
      monthDays - The set with month days
    • getJobs

      public ArrayList<Job> getJobs()
      Returns the ArrayList with jobs
      Returns:
      The ArryList with jobs
    • cancel

      public void cancel()
      Cancel the timer
    • jobIterator

      public Iterator jobIterator()
      Returns the Iterator of jobs
      Returns:
      The Iterator of jobs
    • getName

      public String getName()
      Returns the name of the JobQueue
      Returns:
      The name of the JobQueue
    • getDescription

      public String getDescription()
      Returns the description of the JobQueue
      Returns:
      The description of the JobQueue
    • getSchedulingDate

      public Date getSchedulingDate()
      Returns the scheduling date of the JobQueue
      Returns:
      The scheduling date of the JobQueue
    • getAt

      public Date getAt()
      Returns the at
      Returns:
      The at
    • getPeriod

      public int getPeriod()
      Returns the period
      Returns:
      The period
    • getState

      public int getState()
      Returns the state
      Returns:
      The state
    • start

      public void start()
      Start a JobQueue
    • stop

      public void stop()
      Stop a JobQueue
    • canRunJob

      public boolean canRunJob()
      Returns true if the JobQueue can run the job, false otherwise
      Returns:
      true if the JobQueue can run the job, false otherwise
    • _getAnotherJob

      protected Job _getAnotherJob(HashSet hs)
    • matches

      protected boolean matches(Date date)
    • runQueue

      protected void runQueue()
    • runQueueNow

      protected void runQueueNow()
    • kill

      public void kill(boolean force)
      Does nothing
      Parameters:
      force - Not used
    • getRunningJob

      public String getRunningJob()
      Returns the running job
      Returns:
      The running job
    • getMode

      public abstract int getMode()
      Returns the mode
      Returns:
      The mode
    • nextExecution

      protected static SDate nextExecution(Date at, int period)