Interface Timer
- All Known Implementing Classes:
TimerImpl
public interface Timer
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfacestatic interface -
Method Summary
Modifier and TypeMethodDescriptioncontext()Creates a Timer context and starts the timerstatic <T> Callable<T> decorateCallable(Timer timer, Callable<T> callable) Creates a timed Callable.static <T,R> io.github.resilience4j.core.functions.CheckedFunction <T, R> decorateCheckedFunction(Timer timer, io.github.resilience4j.core.functions.CheckedFunction<T, R> function) Creates a timed function.static io.github.resilience4j.core.functions.CheckedRunnabledecorateCheckedRunnable(Timer timer, io.github.resilience4j.core.functions.CheckedRunnable runnable) Creates a timed runnable.static <T> io.github.resilience4j.core.functions.CheckedSupplier<T> decorateCheckedSupplier(Timer timer, io.github.resilience4j.core.functions.CheckedSupplier<T> supplier) Creates a timed checked supplier.static <T> Supplier<CompletionStage<T>> decorateCompletionStageSupplier(Timer timer, Supplier<CompletionStage<T>> stageSupplier) static <T,R> Function <T, R> decorateFunction(Timer timer, Function<T, R> function) Creates a timed function.static RunnabledecorateRunnable(Timer timer, Runnable runnable) Creates a timed runnable.static <T> Supplier<T> decorateSupplier(Timer timer, Supplier<T> supplier) Creates a timed checked supplier.default <T> TexecuteCallable(Callable<T> callable) Decorates and executes the decorated Callable.default <T> CompletionStage<T> executeCompletionStageSupplier(Supplier<CompletionStage<T>> supplier) Decorates and executes the decorated CompletionStage Supplier.default voidexecuteRunnable(Runnable runnable) Decorates and executes the decorated Runnable.default <T> TexecuteSupplier(Supplier<T> supplier) Decorates and executes the decorated Supplier.com.codahale.metrics.MetricRegistryReturns the MetricRegistry of this Timer.Returns the Metrics of this Timer.getName()Returns the name of this Timer.static TimerCreates a timer of a default MetricRegistrystatic TimerofMetricRegistry(String name, com.codahale.metrics.MetricRegistry metricRegistry) Creates a timer of a provided MetricRegistry
-
Method Details
-
ofMetricRegistry
-
of
-
decorateCheckedSupplier
static <T> io.github.resilience4j.core.functions.CheckedSupplier<T> decorateCheckedSupplier(Timer timer, io.github.resilience4j.core.functions.CheckedSupplier<T> supplier) Creates a timed checked supplier.- Parameters:
timer- the timer to usesupplier- the original supplier- Returns:
- a timed supplier
-
decorateCheckedRunnable
static io.github.resilience4j.core.functions.CheckedRunnable decorateCheckedRunnable(Timer timer, io.github.resilience4j.core.functions.CheckedRunnable runnable) Creates a timed runnable.- Parameters:
timer- the timer to userunnable- the original runnable- Returns:
- a timed runnable
-
decorateSupplier
-
decorateCallable
-
decorateRunnable
-
decorateFunction
-
decorateCheckedFunction
static <T,R> io.github.resilience4j.core.functions.CheckedFunction<T,R> decorateCheckedFunction(Timer timer, io.github.resilience4j.core.functions.CheckedFunction<T, R> function) Creates a timed function.- Parameters:
timer- the timer to usefunction- the original function- Returns:
- a timed function
-
decorateCompletionStageSupplier
static <T> Supplier<CompletionStage<T>> decorateCompletionStageSupplier(Timer timer, Supplier<CompletionStage<T>> stageSupplier) - Parameters:
timer- the timer to usestageSupplier- the CompletionStage Supplier- Returns:
- a decorated completion stage
-
context
-
getName
-
getMetricRegistry
com.codahale.metrics.MetricRegistry getMetricRegistry()Returns the MetricRegistry of this Timer.- Returns:
- the MetricRegistry of this Timer
-
getMetrics
-
executeRunnable
Decorates and executes the decorated Runnable.- Parameters:
runnable- the original Callable
-
executeCallable
-
executeSupplier
Decorates and executes the decorated Supplier.- Type Parameters:
T- the type of results supplied by this supplier- Parameters:
supplier- the original Supplier- Returns:
- the result of the decorated Supplier.
-
executeCompletionStageSupplier
default <T> CompletionStage<T> executeCompletionStageSupplier(Supplier<CompletionStage<T>> supplier) Decorates and executes the decorated CompletionStage Supplier.- Type Parameters:
T- the type of results supplied by this supplier- Parameters:
supplier- the CompletionStage Supplier- Returns:
- the result of the decorated Supplier.
-