Package io.github.resilience4j.metrics
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
Creates a timer of a provided MetricRegistry- Parameters:
name- the name of the timermetricRegistry- the MetricRegistry- Returns:
- a Timer instance
-
of
Creates a timer of a default MetricRegistry- Parameters:
name- the name of the timer- Returns:
- a Timer instance
-
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
Creates a timed checked supplier.- Parameters:
timer- the timer to usesupplier- the original supplier- Returns:
- a timed supplier
-
decorateCallable
Creates a timed Callable.- Parameters:
timer- the timer to usecallable- the original Callable- Returns:
- a timed Callable
-
decorateRunnable
Creates a timed runnable.- Parameters:
timer- the timer to userunnable- the original runnable- Returns:
- a timed runnable
-
decorateFunction
Creates a timed function.- Parameters:
timer- the timer to usefunction- the original function- Returns:
- a timed function
-
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
Timer.Context context()Creates a Timer context and starts the timer- Returns:
- the Timer context
-
getName
String getName()Returns the name of this Timer.- Returns:
- the name of this Timer
-
getMetricRegistry
com.codahale.metrics.MetricRegistry getMetricRegistry()Returns the MetricRegistry of this Timer.- Returns:
- the MetricRegistry of this Timer
-
getMetrics
Timer.Metrics getMetrics()Returns the Metrics of this Timer.- Returns:
- the Metrics of this Timer
-
executeRunnable
Decorates and executes the decorated Runnable.- Parameters:
runnable- the original Callable
-
executeCallable
Decorates and executes the decorated Callable.- Type Parameters:
T- the type of results supplied by this Callable- Parameters:
callable- the original Callable- Returns:
- the result of the decorated Callable.
- Throws:
Exception
-
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.
-