Package de.dlr.proseo.api.basemon
Class BaseMonitor
java.lang.Object
java.lang.Thread
de.dlr.proseo.api.basemon.BaseMonitor
- All Implemented Interfaces:
Runnable
Base class for implementing monitors on pickup points ("interface points" in the ESA Ground Segment Framework architecture). The
monitor is intended to run "forever" (i. e. until it is shut down by an interrupt), so it does not terminate on errors during
transfer or follow-up actions. It does terminate if it cannot correctly write its transfer history.
- Author:
- Dr. Thomas Bassler
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classStructure for controlling the transfer processNested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract BaseMonitor.TransferControlcheckAvailableDownloads(Instant referenceTimeStamp) Check the pickup point for available objects (unfiltered)longGets the interval between pickup point checksGets the period to retain transfer history entries forintGets the maximum number of parallel download threadsintGets the maximum number of wait cycles for task completion checksintGets the interval to check for completed subtasksGets the file path of the transfer history filelongGets the interval to truncate transfer history filevoidrun()Run forever (as required by Thread superclass, at the same time convenience function for callingrun(Integer)with anullargument)voidMonitoring loop: Check data availability on pickup point Filter objects not yet processed from transfer history For all objects not yet processed: Transfer object to local target directory Record transfer in history Trigger follow-on actionvoidsetCheckInterval(long checkInterval) Sets the interval between pickup point checksvoidsetHistoryRetentionDuration(Duration historyRetentionDuration) Sets the period to retain transfer history entries forvoidsetMaxDownloadThreads(int maxDownloadThreads) Sets the maximum number of parallel download threadsvoidsetMaxWaitCycles(int maxWaitCycles) Sets the maximum number of wait cycles for task completion checksvoidsetTaskWaitInterval(int taskWaitInterval) Sets the interval to check for completed subtasksvoidsetTransferHistoryFile(Path transferHistoryFile) Gets the file path of the transfer history filevoidsetTruncateInterval(long truncateInterval) Sets the interval to truncate transfer history fileprotected abstract booleantransferToTargetDir(TransferObject object) Download the given transfer object from the pickup point and copy it to the configured target directoryprotected abstract booleantriggerFollowOnAction(TransferObject object) Trigger any necessary follow-on action on the transfer object (processing, order generation etc.)Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
Constructor Details
-
BaseMonitor
public BaseMonitor()
-
-
Method Details
-
getCheckInterval
public long getCheckInterval()Gets the interval between pickup point checks- Returns:
- the checkInterval the interval in milliseconds
-
setCheckInterval
public void setCheckInterval(long checkInterval) Sets the interval between pickup point checks- Parameters:
checkInterval- the check interval to set in milliseconds
-
getTransferHistoryFile
Gets the file path of the transfer history file- Returns:
- the path to the transfer history file
-
setTransferHistoryFile
Gets the file path of the transfer history file- Parameters:
transferHistoryFile- the path to the transfer history file to set
-
getTruncateInterval
public long getTruncateInterval()Gets the interval to truncate transfer history file- Returns:
- the truncation interval
-
setTruncateInterval
public void setTruncateInterval(long truncateInterval) Sets the interval to truncate transfer history file- Parameters:
truncateInterval- the truncation interval to set
-
getHistoryRetentionDuration
Gets the period to retain transfer history entries for- Returns:
- the history retention duration
-
setHistoryRetentionDuration
Sets the period to retain transfer history entries for- Parameters:
historyRetentionDuration- the history retention duration to set
-
getMaxDownloadThreads
public int getMaxDownloadThreads()Gets the maximum number of parallel download threads- Returns:
- the maximum number of download threads
-
setMaxDownloadThreads
public void setMaxDownloadThreads(int maxDownloadThreads) Sets the maximum number of parallel download threads- Parameters:
maxDownloadThreads- the maximum number of download threads to set
-
getTaskWaitInterval
public int getTaskWaitInterval()Gets the interval to check for completed subtasks- Returns:
- the task wait interval in millliseconds
-
setTaskWaitInterval
public void setTaskWaitInterval(int taskWaitInterval) Sets the interval to check for completed subtasks- Parameters:
taskWaitInterval- the task wait interval in millliseconds to set
-
getMaxWaitCycles
public int getMaxWaitCycles()Gets the maximum number of wait cycles for task completion checks- Returns:
- the maximum number of wait cycles
-
setMaxWaitCycles
public void setMaxWaitCycles(int maxWaitCycles) Sets the maximum number of wait cycles for task completion checks- Parameters:
maxWaitCycles- the maximum number of wait cycles to set
-
checkAvailableDownloads
Check the pickup point for available objects (unfiltered)- Parameters:
referenceTimeStamp- the reference timestamp to apply for pickup point lookups- Returns:
- a transfer control object containing the latest reference time and a list of available transfer objects
-
transferToTargetDir
Download the given transfer object from the pickup point and copy it to the configured target directory- Parameters:
object- the transfer object to download- Returns:
- true, if the download was successful, false otherwise
-
triggerFollowOnAction
Trigger any necessary follow-on action on the transfer object (processing, order generation etc.)- Parameters:
object- the transfer object to start the action on- Returns:
- true, if starting the action succeeded (not necessarily the action itself), false otherwise
-
run
Monitoring loop:- Check data availability on pickup point
- Filter objects not yet processed from transfer history
- For all objects not yet processed:
- Transfer object to local target directory
- Record transfer in history
- Trigger follow-on action
- Parameters:
maxCycles- maximum number of loop cycles (if null, run forever)
-
run
public void run()Run forever (as required by Thread superclass, at the same time convenience function for callingrun(Integer)with anullargument)
-