Class HarvestScheduler

java.lang.Object
org.dspace.harvest.HarvestScheduler
All Implemented Interfaces:
Runnable

public class HarvestScheduler extends Object implements Runnable
The class responsible for scheduling harvesting cycles are regular intervals.
Author:
alexey
  • Field Details

    • log

      protected static org.apache.logging.log4j.Logger log
    • harvestAdmin

      protected static EPerson harvestAdmin
    • mainContext

      protected Context mainContext
    • lock

      public static final Object lock
    • harvestThreads

      protected static Stack<HarvestThread> harvestThreads
    • maxActiveThreads

      protected static Integer maxActiveThreads
    • activeThreads

      protected static volatile Integer activeThreads
    • HARVESTER_STATUS_RUNNING

      public static final int HARVESTER_STATUS_RUNNING
      See Also:
    • HARVESTER_STATUS_SLEEPING

      public static final int HARVESTER_STATUS_SLEEPING
      See Also:
    • HARVESTER_STATUS_PAUSED

      public static final int HARVESTER_STATUS_PAUSED
      See Also:
    • HARVESTER_STATUS_STOPPED

      public static final int HARVESTER_STATUS_STOPPED
      See Also:
    • HARVESTER_INTERRUPT_NONE

      public static final int HARVESTER_INTERRUPT_NONE
      See Also:
    • HARVESTER_INTERRUPT_PAUSE

      public static final int HARVESTER_INTERRUPT_PAUSE
      See Also:
    • HARVESTER_INTERRUPT_STOP

      public static final int HARVESTER_INTERRUPT_STOP
      See Also:
    • HARVESTER_INTERRUPT_RESUME

      public static final int HARVESTER_INTERRUPT_RESUME
      See Also:
    • HARVESTER_INTERRUPT_INSERT_THREAD

      public static final int HARVESTER_INTERRUPT_INSERT_THREAD
      See Also:
    • HARVESTER_INTERRUPT_KILL_THREAD

      public static final int HARVESTER_INTERRUPT_KILL_THREAD
      See Also:
    • status

      protected static int status
    • interruptValue

      protected static UUID interruptValue
    • minHeartbeat

      protected static long minHeartbeat
    • maxHeartbeat

      protected static long maxHeartbeat
  • Constructor Details

  • Method Details

    • hasStatus

      public static boolean hasStatus(int statusToCheck)
    • setInterrupt

      public static void setInterrupt(int newInterrupt)
    • setInterrupt

      public static void setInterrupt(int newInterrupt, UUID newInterruptValue)
    • getInterrupt

      public static int getInterrupt()
    • getStatus

      public static String getStatus()
    • run

      public void run()
      Specified by:
      run in interface Runnable
    • scheduleLoop

      protected void scheduleLoop()
    • addThread

      public void addThread(Context context, HarvestedCollection harvestedCollection) throws SQLException, IOException, AuthorizeException
      Adds a thread to the ready stack. Can also be called externally to queue up a collection for harvesting before it is "due" for another cycle. This allows starting a harvest process from the UI that still "plays nice" with these thread mechanics instead of making an asynchronous call to runHarvest().
      Parameters:
      context - The relevant DSpace Context.
      harvestedCollection - collection to be harvested
      Throws:
      IOException - A general class of exceptions produced by failed or interrupted I/O operations.
      SQLException - An exception that provides information on a database access error or other errors.
      AuthorizeException - Exception indicating the current user of the context does not have permission to perform a particular action.