Class LatestTaskSwingWorkerExecutor<T,R>
java.lang.Object
com.inductiveautomation.ignition.designer.mvvm.LatestTaskSwingWorkerExecutor<T,R>
- Type Parameters:
T- the type of input to be processedR- the type of result produced by the processing
This class is used for processing tasks in the background, ensuring that only the latest task is processed.
If a new task is submitted while another is being processed, the new task will be processed immediately after
the current task completes.
It is useful for scenarios where the output of only the latest task matters, such as validating user input. The current task is considered if there's a change in input while processing.
The class uses a ViewModelSwingWorkerExecutor to execute tasks asynchronously.
This class is not thread-safe and should be used from a single thread, typically the UI thread.
-
Constructor Summary
ConstructorsConstructorDescriptionLatestTaskSwingWorkerExecutor(ViewModelSwingWorkerExecutor executor, Function<T, R> onDoInBackground, BiConsumer<R, Exception> onDone) LatestTaskSwingWorkerExecutor(Function<T, R> onDoInBackground, BiConsumer<R, Exception> onDone) -
Method Summary
-
Constructor Details
-
LatestTaskSwingWorkerExecutor
-
LatestTaskSwingWorkerExecutor
public LatestTaskSwingWorkerExecutor(ViewModelSwingWorkerExecutor executor, Function<T, R> onDoInBackground, BiConsumer<R, Exception> onDone)
-
-
Method Details
-
markStale
public void markStale()Marks the current value as stale. In a scenario where the input is debounced, this can be used to indicate that the current input is no longer relevant and should not be processed. -
process
-