Package org.dspace.harvest
Class HarvestScheduler
java.lang.Object
org.dspace.harvest.HarvestScheduler
- All Implemented Interfaces:
Runnable
The class responsible for scheduling harvesting cycles are regular intervals.
- Author:
- alexey
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static Integerprotected static EPersonstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intprotected static Stack<HarvestThread>protected static UUIDstatic final Objectprotected static org.apache.logging.log4j.Loggerprotected Contextprotected static Integerprotected static longprotected static longprotected static int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddThread(Context context, HarvestedCollection harvestedCollection) Adds a thread to the ready stack.static intstatic Stringstatic booleanhasStatus(int statusToCheck) voidrun()protected voidstatic voidsetInterrupt(int newInterrupt) static voidsetInterrupt(int newInterrupt, UUID newInterruptValue)
-
Field Details
-
log
protected static org.apache.logging.log4j.Logger log -
harvestAdmin
-
mainContext
-
lock
-
harvestThreads
-
maxActiveThreads
-
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
-
minHeartbeat
protected static long minHeartbeat -
maxHeartbeat
protected static long maxHeartbeat
-
-
Constructor Details
-
HarvestScheduler
- Throws:
SQLExceptionAuthorizeException
-
-
Method Details
-
hasStatus
public static boolean hasStatus(int statusToCheck) -
setInterrupt
public static void setInterrupt(int newInterrupt) -
setInterrupt
-
getInterrupt
public static int getInterrupt() -
getStatus
-
run
public void run() -
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.
-