Package org.dspace.harvest
Class HarvestScheduler
- java.lang.Object
-
- org.dspace.harvest.HarvestScheduler
-
-
Field Summary
Fields Modifier and Type Field Description protected static IntegeractiveThreadsprotected static EPersonharvestAdminstatic intHARVESTER_INTERRUPT_INSERT_THREADstatic intHARVESTER_INTERRUPT_KILL_THREADstatic intHARVESTER_INTERRUPT_NONEstatic intHARVESTER_INTERRUPT_PAUSEstatic intHARVESTER_INTERRUPT_RESUMEstatic intHARVESTER_INTERRUPT_STOPstatic intHARVESTER_STATUS_PAUSEDstatic intHARVESTER_STATUS_RUNNINGstatic intHARVESTER_STATUS_SLEEPINGstatic intHARVESTER_STATUS_STOPPEDprotected static Stack<HarvestThread>harvestThreadsprotected static UUIDinterruptValuestatic Objectlockprotected static org.apache.logging.log4j.Loggerlogprotected ContextmainContextprotected static IntegermaxActiveThreadsprotected static longmaxHeartbeatprotected static longminHeartbeatprotected static intstatus
-
Constructor Summary
Constructors Constructor Description HarvestScheduler()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddThread(Context context, HarvestedCollection harvestedCollection)Adds a thread to the ready stack.static intgetInterrupt()static StringgetStatus()static booleanhasStatus(int statusToCheck)voidrun()protected voidscheduleLoop()static voidsetInterrupt(int newInterrupt)static voidsetInterrupt(int newInterrupt, UUID newInterruptValue)
-
-
-
Field Detail
-
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:
- Constant Field Values
-
HARVESTER_STATUS_SLEEPING
public static final int HARVESTER_STATUS_SLEEPING
- See Also:
- Constant Field Values
-
HARVESTER_STATUS_PAUSED
public static final int HARVESTER_STATUS_PAUSED
- See Also:
- Constant Field Values
-
HARVESTER_STATUS_STOPPED
public static final int HARVESTER_STATUS_STOPPED
- See Also:
- Constant Field Values
-
HARVESTER_INTERRUPT_NONE
public static final int HARVESTER_INTERRUPT_NONE
- See Also:
- Constant Field Values
-
HARVESTER_INTERRUPT_PAUSE
public static final int HARVESTER_INTERRUPT_PAUSE
- See Also:
- Constant Field Values
-
HARVESTER_INTERRUPT_STOP
public static final int HARVESTER_INTERRUPT_STOP
- See Also:
- Constant Field Values
-
HARVESTER_INTERRUPT_RESUME
public static final int HARVESTER_INTERRUPT_RESUME
- See Also:
- Constant Field Values
-
HARVESTER_INTERRUPT_INSERT_THREAD
public static final int HARVESTER_INTERRUPT_INSERT_THREAD
- See Also:
- Constant Field Values
-
HARVESTER_INTERRUPT_KILL_THREAD
public static final int HARVESTER_INTERRUPT_KILL_THREAD
- See Also:
- Constant Field Values
-
status
protected static int status
-
interruptValue
protected static UUID interruptValue
-
minHeartbeat
protected static long minHeartbeat
-
maxHeartbeat
protected static long maxHeartbeat
-
-
Constructor Detail
-
HarvestScheduler
public HarvestScheduler() throws SQLException, AuthorizeException- Throws:
SQLExceptionAuthorizeException
-
-
Method Detail
-
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()
-
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.
-
-