Package io.debezium.util
Interface Stopwatch.StopwatchSet
- All Superinterfaces:
Stopwatch.Durations
- Enclosing class:
- Stopwatch
A set of stopwatches whose durations are combined. New stopwatches can be created at any time, and when
Stopwatch.stop() will always record their duration with this set.
This set is threadsafe, meaning that multiple threads can create() new stopwatches concurrently, and each
stopwatch's duration is measured separately. Additionally, all of the other methods of this interface are also threadsafe.
-
Method Summary
Modifier and TypeMethodDescriptionvoidawait()Block until all running stopwatches have beenstopped.voidcreate()Create a new stopwatch that records durations with this set.default voidTime the given function multiple times.default <T> voidTime the given function multiple times.default voidTime the given function.default <T> TTime the given function.Methods inherited from interface io.debezium.util.Stopwatch.Durations
statistics
-
Method Details
-
create
Stopwatch create()Create a new stopwatch that records durations with this set.- Returns:
- the new stopwatch; never null
-
time
Time the given function.- Parameters:
runnable- the function to call
-
time
Time the given function.- Parameters:
runnable- the function that is to be executed; may not be null- Returns:
- the result of the operation
-
time
Time the given function multiple times.- Parameters:
repeat- the number of times to repeat the function call; must be positiverunnable- the function to call; may not be null
-
time
Time the given function multiple times.- Parameters:
repeat- the number of times to repeat the function call; must be positiverunnable- the function that is to be executed a number of times; may not be nullcleanup- the function that is to be called after each time call to the runnable function, and not included in the time measurements; may be null- Throws:
Exception- the exception thrown by the runnable function
-
await
Block until all running stopwatches have beenstopped. This means that if a stopwatch iscreatedbut never started, this method will not wait for it. Likewise, if a stopwatch iscreatedand started, then this method will block until the stopwatch isstopped(even if the same stopwatch is started multiple times). are stopped.- Throws:
InterruptedException- if the thread is interrupted before unblocking
-
await
- Parameters:
timeout- the maximum length of time that this method should blockunit- the unit for the timeout; may not be null- Throws:
InterruptedException- if the thread is interrupted before unblocking
-