public interface Timer
| Modifier and Type | Interface and Description |
|---|---|
static interface |
Timer.Context |
static interface |
Timer.Metrics |
| Modifier and Type | Method and Description |
|---|---|
Timer.Context |
context()
Creates a Timer context and starts the timer
|
static <T> java.util.concurrent.Callable<T> |
decorateCallable(Timer timer,
java.util.concurrent.Callable<T> callable)
Creates a timed Callable.
|
static <T,R> io.vavr.CheckedFunction1<T,R> |
decorateCheckedFunction(Timer timer,
io.vavr.CheckedFunction1<T,R> function)
Creates a timed function.
|
static io.vavr.CheckedRunnable |
decorateCheckedRunnable(Timer timer,
io.vavr.CheckedRunnable runnable)
Creates a timed runnable.
|
static <T> io.vavr.CheckedFunction0<T> |
decorateCheckedSupplier(Timer timer,
io.vavr.CheckedFunction0<T> supplier)
Creates a timed checked supplier.
|
static <T> java.util.function.Supplier<java.util.concurrent.CompletionStage<T>> |
decorateCompletionStageSupplier(Timer timer,
java.util.function.Supplier<java.util.concurrent.CompletionStage<T>> stageSupplier) |
static <T,R> java.util.function.Function<T,R> |
decorateFunction(Timer timer,
java.util.function.Function<T,R> function)
Creates a timed function.
|
static java.lang.Runnable |
decorateRunnable(Timer timer,
java.lang.Runnable runnable)
Creates a timed runnable.
|
static <T> java.util.function.Supplier<T> |
decorateSupplier(Timer timer,
java.util.function.Supplier<T> supplier)
Creates a timed checked supplier.
|
default <T> T |
executeCallable(java.util.concurrent.Callable<T> callable)
Decorates and executes the decorated Callable.
|
default <T> java.util.concurrent.CompletionStage<T> |
executeCompletionStageSupplier(java.util.function.Supplier<java.util.concurrent.CompletionStage<T>> supplier)
Decorates and executes the decorated CompletionStage Supplier.
|
default void |
executeRunnable(java.lang.Runnable runnable)
Decorates and executes the decorated Runnable.
|
default <T> T |
executeSupplier(java.util.function.Supplier<T> supplier)
Decorates and executes the decorated Supplier.
|
com.codahale.metrics.MetricRegistry |
getMetricRegistry()
Returns the MetricRegistry of this Timer.
|
Timer.Metrics |
getMetrics()
Returns the Metrics of this Timer.
|
java.lang.String |
getName()
Returns the name of this Timer.
|
static Timer |
of(java.lang.String name)
Creates a timer of a default MetricRegistry
|
static Timer |
ofMetricRegistry(java.lang.String name,
com.codahale.metrics.MetricRegistry metricRegistry)
Creates a timer of a provided MetricRegistry
|
static Timer ofMetricRegistry(java.lang.String name, com.codahale.metrics.MetricRegistry metricRegistry)
name - the name of the timermetricRegistry - the MetricRegistrystatic Timer of(java.lang.String name)
name - the name of the timerstatic <T> io.vavr.CheckedFunction0<T> decorateCheckedSupplier(Timer timer, io.vavr.CheckedFunction0<T> supplier)
timer - the timer to usesupplier - the original supplierstatic io.vavr.CheckedRunnable decorateCheckedRunnable(Timer timer, io.vavr.CheckedRunnable runnable)
timer - the timer to userunnable - the original runnablestatic <T> java.util.function.Supplier<T> decorateSupplier(Timer timer, java.util.function.Supplier<T> supplier)
timer - the timer to usesupplier - the original supplierstatic <T> java.util.concurrent.Callable<T> decorateCallable(Timer timer, java.util.concurrent.Callable<T> callable)
timer - the timer to usecallable - the original Callablestatic java.lang.Runnable decorateRunnable(Timer timer, java.lang.Runnable runnable)
timer - the timer to userunnable - the original runnablestatic <T,R> java.util.function.Function<T,R> decorateFunction(Timer timer, java.util.function.Function<T,R> function)
timer - the timer to usefunction - the original functionstatic <T,R> io.vavr.CheckedFunction1<T,R> decorateCheckedFunction(Timer timer, io.vavr.CheckedFunction1<T,R> function)
timer - the timer to usefunction - the original functionstatic <T> java.util.function.Supplier<java.util.concurrent.CompletionStage<T>> decorateCompletionStageSupplier(Timer timer, java.util.function.Supplier<java.util.concurrent.CompletionStage<T>> stageSupplier)
timer - the timer to usestageSupplier - the CompletionStage SupplierTimer.Context context()
java.lang.String getName()
com.codahale.metrics.MetricRegistry getMetricRegistry()
Timer.Metrics getMetrics()
default void executeRunnable(java.lang.Runnable runnable)
runnable - the original Callabledefault <T> T executeCallable(java.util.concurrent.Callable<T> callable)
throws java.lang.Exception
T - the type of results supplied by this Callablecallable - the original Callablejava.lang.Exceptiondefault <T> T executeSupplier(java.util.function.Supplier<T> supplier)
T - the type of results supplied by this suppliersupplier - the original Supplierdefault <T> java.util.concurrent.CompletionStage<T> executeCompletionStageSupplier(java.util.function.Supplier<java.util.concurrent.CompletionStage<T>> supplier)
T - the type of results supplied by this suppliersupplier - the CompletionStage Supplier