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 Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final int
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addTaskListener
(TaskListener listener) int
The percentage of completion(1-100)getName()
long
The current processing stepScheduling policieslong
getSize()
The the total size of the processing(number of units of work)int
The task status.void
abstract boolean
Concrete implementations must override this method declaring if the task supports multiple instances running concurrently.abstract boolean
Concrete implementations must override this method declaring if the task is indeterminate.boolean
boolean
boolean
Check if the task is currently runningboolean
void
void
removeTaskListener
(TaskListener listener) void
run()
void
save()
Saves the task configurationvoid
saveWork()
Concrete implementations must insert here the code needed to save the elaboration state in a persistent storagevoid
setConfig
(ContextProperties config) void
setLockManager
(LockManager lockManager) void
setReportRecipients
(String reportRecipients) void
setSendActivityReport
(boolean sendActivityReport) void
setSender
(EMailSender sender) void
setSize
(long size) void
setSystemLoadMonitor
(SystemLoadMonitor systemLoadMonitor) void
setUserDao
(UserDAO userDao)
-
Field Details
-
STATUS_IDLE
public static final int STATUS_IDLE- See Also:
-
STATUS_RUNNING
public static final int STATUS_RUNNING- See Also:
-
STATUS_STOPPING
public static final int STATUS_STOPPING- See Also:
-
-
Method Details
-
getName
-
run
public void run() -
interrupt
public void interrupt() -
isInterrupted
public boolean isInterrupted() -
getSize
public long getSize()The the total size of the processing(number of units of work)- Returns:
- total number of steps
-
setSize
public void setSize(long size) -
getStatus
public int getStatus()The task status.- Returns:
- the status
- See Also:
-
getProgress
public long getProgress()The current processing step- Returns:
- the current step
-
getCompletionPercentage
public int getCompletionPercentage()The percentage of completion(1-100)- Returns:
- a percentage(1-100)
-
isRunning
public boolean isRunning()Check if the task is currently running- Returns:
- true if the task is running(
STATUS_RUNNING
)
-
saveWork
public void saveWork()Concrete implementations must insert here the code needed to save the elaboration state in a persistent storage -
getScheduling
Scheduling policies- Returns:
- the scheduling policies
-
addTaskListener
-
removeTaskListener
-
notifyReport
public void notifyReport() -
isIndeterminate
public 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
-
isConcurrent
public 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
-
setConfig
-
setSender
-
setUserDao
-
save
Saves the task configuration- Throws:
ParseException
- raised if the configuration cannot be parsedIOException
- raised if the configuration cannot be written
-
isSendActivityReport
public boolean isSendActivityReport() -
setSendActivityReport
public void setSendActivityReport(boolean sendActivityReport) -
setReportRecipients
-
setLockManager
-
setSystemLoadMonitor
-
isInterruptRequested
public boolean isInterruptRequested()
-