T
- the current Service Task typepublic final class ServiceTaskBase<T> extends Task<T> implements JRebirthRunnable, ServiceTask<T>, ServiceMessages
exceptionProperty, messageProperty, onCancelledProperty, onFailedProperty, onRunningProperty, onScheduledProperty, onSucceededProperty, progressProperty, runningProperty, stateProperty, titleProperty, totalWorkProperty, valueProperty, workDoneProperty
exceptionProperty, messageProperty, progressProperty, runningProperty, stateProperty, titleProperty, totalWorkProperty, valueProperty, workDoneProperty
Worker.State
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_EXCEPTION, SERVICE_TASK_HANDLE_EXCEPTION, SERVICE_TASK_HAS_FAILED, SERVICE_TASK_NOT_MANAGED_EXCEPTION, SERVICE_TASK_RETURN_CONSUMES, SERVICE_TASK_RETURN_HANDLES
Constructor and Description |
---|
ServiceTaskBase(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.
|
Instant |
creationTime()
Return the creation time.
|
Wave |
getAssociatedWave() |
String |
getServiceHandlerName()
Return the full service handler name.
|
PriorityLevel |
priority()
Return the runnable priority.
|
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, updateValue, valueProperty, workDoneProperty
done, get, get, isCancelled, isDone, run, runAndReset, set, setException
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
cancel, exceptionProperty, getException, getMessage, getProgress, getState, getTitle, getTotalWork, getValue, getWorkDone, isRunning, messageProperty, progressProperty, runningProperty, stateProperty, titleProperty, totalWorkProperty, valueProperty, workDoneProperty
ServiceTaskBase(Service service, Method method, Object[] parameterValues, Wave wave)
parameterValues
- the list of function parametermethod
- the method to callservice
- the service objectwave
- the wave to processpublic String getServiceHandlerName()
getServiceHandlerName
in interface ServiceTask<T>
protected T call() throws CoreException
call
in class Task<T>
CoreException
- if return WaveType has bad APIpublic 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()
taskAchieved
in interface ServiceTask<T>
public Wave getAssociatedWave()
getAssociatedWave
in interface ServiceTask<T>
public boolean checkProgressRatio(double newWorkDone, double totalWork, double amountThreshold)
checkProgressRatio
in interface ServiceTask<T>
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 PriorityLevel priority()
priority
in interface JRebirthRunnable
public Instant creationTime()
creationTime
in interface JRebirthRunnable
Copyright © 2011–2016 JRebirth OSS. All rights reserved.