public class ClientProgressManager extends java.lang.Object implements ProgressManager
It can be accessed through the static getInstance function as well as through the ClientContext.
The way the progress system works is that long running tasks (that is, any task that takes long enough that progress
might be desired) are wrapped up as a AsyncClientTask
, and are run through this manager.
When a task is registered, a TaskHandle
is returned, which can be used to monitor status, wait for a result,
and get the return value of the asynchronous operation. It can also be used to cancel the task.
The class registering the operation does not need to worry about displaying status, as that is handled by the system. However, it is possible to "pause" the UI in situations where having a pop up display open is undesirable. Calling setUIPaused affects all outstanding progress operations, and should therefore be called very carefully.
Tasks executing against the gateway
It's important to note that the gateway has a separate notion of asynchronous tasks. For the best results, the
progress system should be used on both sides, but they are fundamentally separate. As a result, operations on the
gateway get their own UID. Asynchronous gateway operations, triggered from the designer (even if not through the
progress system!), can publish updates to the designer progress manager. Thus it's possible that a progress dialog
might be shown even when you are not using the client progress manager to run a task.
In a normal, fully async setup, you would end up with the following progress updates:
ClientOp
GatewayOp
GatewayOp
GatewayOp
ClientOp
The client operation and gateway operations are seen as two seperate tasks. Which is displayed is based on whether the first task is dominant. If the client task is dominant, it will stay displayed, and its progress will be updated. If not, the display will switch to the gateway task when it comes in, and will stay on that until it's finished.
More information about the way the gateway progress system works can be found on the GatewayProgressManager page.
Modifier and Type | Class and Description |
---|---|
protected class |
ClientProgressManager.ClientRunningTask |
protected class |
ClientProgressManager.GatewayRunningTask |
static interface |
ClientProgressManager.ModelListener |
protected class |
ClientProgressManager.RunningTask |
PUSH_PROTOCOL_UPDATE
Modifier and Type | Method and Description |
---|---|
void |
addListener(ClientProgressManager.ModelListener listener) |
void |
cancelAllTasks() |
void |
cancelTask(java.lang.String uid) |
protected ExecutionManager |
getExecutionManager() |
static ClientProgressManager |
getInstance() |
protected org.apache.log4j.Logger |
getLogger() |
java.util.List<TaskProgressState> |
getStates() |
TaskHandle |
registerGatewayTask(java.lang.String taskId) |
protected void |
registerTask(ClientProgressManager.RunningTask task) |
void |
removeListener(ClientProgressManager.ModelListener listener) |
<T> void |
run(java.util.concurrent.CompletableFuture<T> cf,
java.util.function.Consumer<T> handler,
java.lang.Object owner) |
TaskHandle |
runTask(AsyncClientTask task)
Executes the provided task asynchronously.
|
TaskHandle |
runTask(AsyncClientTask task,
boolean dominant)
Executes a task.
|
void |
setClientContext(ClientContext context) |
void |
setUIPaused(boolean value) |
void |
shutdown() |
void |
startup() |
protected void |
unregisterTask(ClientProgressManager.RunningTask task) |
protected void |
updateTask(TaskProgressState state) |
protected void |
updateUI() |
public static ClientProgressManager getInstance()
public void startup()
protected ExecutionManager getExecutionManager()
protected org.apache.log4j.Logger getLogger()
public void addListener(ClientProgressManager.ModelListener listener)
public void removeListener(ClientProgressManager.ModelListener listener)
public void setUIPaused(boolean value)
public void shutdown()
public TaskHandle runTask(AsyncClientTask task)
Returns a TaskHandle that can be used to wait for the task to finish, cancel the task, etc.
public TaskHandle runTask(AsyncClientTask task, boolean dominant)
dominant
- true indicates that this task should be favored for display, and will spawn subtasks that it will
account for in its progress.public <T> void run(java.util.concurrent.CompletableFuture<T> cf, java.util.function.Consumer<T> handler, java.lang.Object owner)
public void cancelAllTasks()
public void cancelTask(java.lang.String uid)
protected void updateTask(TaskProgressState state)
public TaskHandle registerGatewayTask(java.lang.String taskId)
protected void registerTask(ClientProgressManager.RunningTask task)
protected void unregisterTask(ClientProgressManager.RunningTask task)
protected void updateUI()
public void setClientContext(ClientContext context)
public java.util.List<TaskProgressState> getStates()