T - the current Service Task typepublic final class ServiceTask<T> extends Task<T> implements JRebirthRunnable, ServiceMessages
exceptionProperty, messageProperty, onCancelledProperty, onFailedProperty, onRunningProperty, onScheduledProperty, onSucceededProperty, progressProperty, runningProperty, stateProperty, titleProperty, totalWorkProperty, valueProperty, workDonePropertyWorker.State| Modifier and Type | Field and Description |
|---|---|
private long |
creationTime
The creation timestamp in milliseconds.
|
private double |
localWorkDone
The workdone copied property stored locally to allow access outside JAT.
|
private static JRLogger |
LOGGER
The class logger.
|
private Method |
method
The
method. |
private Object[] |
parameterValues
The
parameterValues. |
private RunnablePriority |
priority
The runnable priority.
|
private Service |
service
The
localService. |
private Wave |
wave
The
sourceWave. |
COUNT_LINES_ERROR, NO_RETURN_WAVE_CONSUMED, NO_RETURNED_WAVE_ITEM, NO_RETURNED_WAVE_TYPE_DEFINED, NO_WAVE_TYPE_DEFINED, SERVICE_TASK_ERROR, SERVICE_TASK_HAS_FAILED, SERVICE_TASK_RETURN_CONSUMES| Constructor and Description |
|---|
ServiceTask(Service service,
Method method,
Object[] parameterValues,
Wave wave)
Default Constructor only visible by service package.
|
| Modifier and Type | Method and Description |
|---|---|
protected T |
call() |
boolean |
checkProgressRatio(double newWorkDone,
double totalWork,
double amountThreshold)
Check if the task has enough progressed according to the given threshold.
|
long |
getCreationTime()
Return the creation time.
|
RunnablePriority |
getPriority()
Return the runnable priority.
|
String |
getServiceHandlerName()
Return the full service handler name.
|
private void |
sendReturnWave(T res)
Send a wave that will carry the service result.
2 Kinds of wave can be sent according to service configuration
|
void |
taskAchieved()
The task has been terminated because the source wave was consumed or has failed.
|
void |
updateMessage(String message) |
void |
updateProgress(double workDone,
double totalWork) |
void |
updateProgress(long workDone,
long totalWork) |
void |
updateTitle(String title) |
addEventFilter, addEventHandler, buildEventDispatchChain, cancel, cancel, cancelled, exceptionProperty, failed, fireEvent, getException, getMessage, getOnCancelled, getOnFailed, getOnRunning, getOnScheduled, getOnSucceeded, getProgress, getState, getTitle, getTotalWork, getValue, getWorkDone, isRunning, messageProperty, onCancelledProperty, onFailedProperty, onRunningProperty, onScheduledProperty, onSucceededProperty, progressProperty, removeEventFilter, removeEventHandler, running, runningProperty, scheduled, setEventHandler, setOnCancelled, setOnFailed, setOnRunning, setOnScheduled, setOnSucceeded, stateProperty, succeeded, titleProperty, totalWorkProperty, valueProperty, workDonePropertydone, get, get, isCancelled, isDone, run, runAndReset, set, setExceptionprivate static final JRLogger LOGGER
private final Object[] parameterValues
parameterValues.private final Method method
method.private final Service service
localService.private final Wave wave
sourceWave.private double localWorkDone
private final RunnablePriority priority
private final long creationTime
public String getServiceHandlerName()
protected T call() throws CoreException
call in class Task<T>CoreException - if return WaveType has bad APIprivate void sendReturnWave(T res) throws CoreException
res - the service resultCoreException - if the wave generation has failedpublic void updateProgress(long workDone,
long totalWork)
updateProgress in class Task<T>public void updateProgress(double workDone,
double totalWork)
updateProgress in class Task<T>public void updateMessage(String message)
updateMessage in class Task<T>public void updateTitle(String title)
updateTitle in class Task<T>public void taskAchieved()
public boolean checkProgressRatio(double newWorkDone,
double totalWork,
double amountThreshold)
newWorkDone - the amount of work donetotalWork - the total amount of workamountThreshold - the minimum threshold amount to return true; range is [0.0 - 100.0] (typically 1.0 for 1%)public RunnablePriority getPriority()
getPriority in interface JRebirthRunnablepublic long getCreationTime()
getCreationTime in interface JRebirthRunnableCopyright © 2011–2014 JRebirth OSS. All rights reserved.