Package com.logicaldoc.core.task
Class Task
java.lang.Object
com.logicaldoc.core.task.Task
- All Implemented Interfaces:
- Runnable
- Direct Known Subclasses:
- AbstractDocumentProcessor,- DigestProcessor,- IndexerTask,- IndexOptimizer,- PathCalculator,- StatsCollector,- TagsProcessor
A task is a long running process that is fired regularly
- Since:
- 3.5.0
- Author:
- Marco Meschieri - LogicalDOC
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final int
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddTaskListener(TaskListener listener) intThe percentage of completion(1-100)getName()longThe current processing stepScheduling policieslonggetSize()The the total size of the processing(number of units of work)intThe task status.voidabstract booleanConcrete implementations must override this method declaring if the task supports multiple instances running concurrently.abstract booleanConcrete implementations must override this method declaring if the task is indeterminate.booleanbooleanbooleanCheck if the task is currently runningbooleanvoidvoidremoveTaskListener(TaskListener listener) voidrun()voidsave()Saves the task configurationvoidsaveWork()Concrete implementations must insert here the code needed to save the elaboration state in a persistent storagevoidsetReportRecipients(String reportRecipients) voidsetSendActivityReport(boolean sendActivityReport) voidsetSize(long size) 
- 
Field Details- 
STATUS_IDLEpublic static final int STATUS_IDLE- See Also:
 
- 
STATUS_RUNNINGpublic static final int STATUS_RUNNING- See Also:
 
- 
STATUS_STOPPINGpublic static final int STATUS_STOPPING- See Also:
 
 
- 
- 
Method Details- 
getName
- 
runpublic void run()
- 
interruptpublic void interrupt()
- 
isInterruptedpublic boolean isInterrupted()
- 
getSizepublic long getSize()The the total size of the processing(number of units of work)- Returns:
- total number of steps
 
- 
setSizepublic void setSize(long size) 
- 
getStatuspublic int getStatus()The task status.- Returns:
- the status
- See Also:
 
- 
getProgresspublic long getProgress()The current processing step- Returns:
- the current step
 
- 
getCompletionPercentagepublic int getCompletionPercentage()The percentage of completion(1-100)- Returns:
- a percentage(1-100)
 
- 
isRunningpublic boolean isRunning()Check if the task is currently running- Returns:
- true if the task is running(STATUS_RUNNING)
 
- 
saveWorkpublic void saveWork()Concrete implementations must insert here the code needed to save the elaboration state in a persistent storage
- 
getSchedulingScheduling policies- Returns:
- the scheduling policies
 
- 
addTaskListener
- 
removeTaskListener
- 
notifyReportpublic void notifyReport()
- 
isIndeterminatepublic abstract boolean isIndeterminate()Concrete implementations must override this method declaring if the task is indeterminate. An indeterminate task is not able to compute it's time length- Returns:
- true if the task is indeterminate
 
- 
isConcurrentpublic abstract boolean isConcurrent()Concrete implementations must override this method declaring if the task supports multiple instances running concurrently.- Returns:
- true if the task is concurrent
 
- 
getReportRecipients
- 
getConfig
- 
saveSaves the task configuration- Throws:
- ParseException- raised if the configuration cannot be parsed
- IOException- raised if the configuration cannot be written
 
- 
isSendActivityReportpublic boolean isSendActivityReport()
- 
setSendActivityReportpublic void setSendActivityReport(boolean sendActivityReport) 
- 
setReportRecipients
- 
isInterruptRequestedpublic boolean isInterruptRequested()
 
-