Package org.eclipse.jface.util
Class Throttler
java.lang.Object
org.eclipse.jface.util.Throttler
A utility class that throttles the execution of a runnable in the UI thread.
- Since:
- 3.14
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
LikethrottledExec()
but if called from Display Thread guaranteed to return before Runnable is runvoid
Schedules the wrapped Runnable to be run after the configured wait time or do nothing if it has already been scheduled but not executed yet.
-
Constructor Details
-
Throttler
Initializes a new throttler object that will throttle the execution of the given runnable in theUI thread
of the given display. The throttler will ensure that the runnable will not run more than everyminWaitTime
, even if it isexecuted
more often.- Parameters:
display
- The display owning the thread onto which the runnable will be executed.minWaitTime
- The minimum duration between each execution of the given runnable (from runnable to return until next run).runnable
- The runnable to throttle.
-
-
Method Details
-
throttledExec
public void throttledExec()Schedules the wrapped Runnable to be run after the configured wait time or do nothing if it has already been scheduled but not executed yet. Can be called from any Thread. If called from Display Thread it may run the Runnable before returning. -
throttledAsyncExec
public void throttledAsyncExec()LikethrottledExec()
but if called from Display Thread guaranteed to return before Runnable is run- Since:
- 3.34
-