Returns the registered instance of the sentry (when applicable).
Returns the registered instance of the sentry (when applicable).
Append an adaptive throughput sentry to the current sentry.
Append an adaptive throughput sentry to the current sentry. See nl.grons.sentries.core.AdaptiveThroughputSentry for more information.
target success ratio, 0 < targetSuccessRatio < 1
, defaults to 0.95
the time between calculations of the current throughput, defaults to 1 second
the minimum number of invocations that must be observed per evaluationDelay
before invocations are throttled, defaults to 0
(>=0)
factor to apply to current throughput ratio, successIncreaseFactor > 1
, defaults to 1.2D
a new sentry that adaptively changes allowed throughput after the current sentry behavior
Append a concurrency limit sentry to the current sentry.
Append a concurrency limit sentry to the current sentry.
number of concurrently allowed invocations
a new sentry that applies a concurrency limit after the current sentry behavior
Append a invocation duration limit sentry to the current sentry.
Append a invocation duration limit sentry to the current sentry.
WARNING: do NOT use this sentry when you invoke it from a Future
or an Actor
.
For such circumstances you are MUCH better of with a timeout on the enclosing future or a timeout message
within the actor.
Reason: this sentry blocks the current thread while waiting on a future that executes the task. Blocking the
current thread is an anti-pattern for futures and actors.
the maximum duration of a call
a new sentry that applies a duration limit after the current sentry behavior
Append a circuit breaker sentry to the current sentry.
Append a circuit breaker sentry to the current sentry. See nl.grons.sentries.core.CircuitBreakerSentry for more information.
number of failure after which the flow will be broken
timeout for trying again, defaults to 1 second
a new sentry that applies a circuit breaker after the current sentry behavior
Append a circuit breaker AND an adaptive throughput sentry to the current sentry.
Append a circuit breaker AND an adaptive throughput sentry to the current sentry. See nl.grons.sentries.core.CircuitBreakerSentry and nl.grons.sentries.core.AdaptiveThroughputSentry for more information.
number of failure after which the flow will be broken by circuit breaker, AND the minimum number of invocations before throttling takes place in the adaptive throughput
timeout for trying again (> 5 milliseconds), defaults to 1 second
target success ratio for adaptive throughput, 0 < targetSuccessRatio < 1
, defaults to 0.95
a new sentry that applies adaptive throughput after a circuit breaker after the current sentry behavior
Append a metric sentry to the current sentry.
Append a metric sentry to the current sentry.
One timer and 2 meter metrics are registered: "all", "fail" and "notAvailable". The "all" timer times and counts all invocations, the "fail" meter counts invocations that threw an exception, and the "notAvailable" meter counts invocations that were blocked by a sentry that is later in the chain (detected by catching nl.grons.sentries.support.NotAvailableExceptions).
When only a timer is needed, use .withTimer instead.
To count the 'not available' invocations, this must be the first sentry in the chain.
For more information see nl.grons.sentries.core.MetricSentry.
a new sentry that collects metrics after the current sentry behavior
Append a rate limit sentry to the current sentry.
Append a rate limit sentry to the current sentry.
number of invocations per time unit
the time unit
a new sentry that applies a concurrency limit after the current sentry behavior
Append a custom sentry to the current sentry.
Append a custom sentry to the current sentry.
a new sentry that applies the given sentry after the current sentry behavior
Append a timer sentry to the current sentry.
Append a timer sentry to the current sentry.
One timer is registered: "all". It is updated for each invocation. For more extensive measuring, use .withMetrics instead.
For more information see nl.grons.sentries.core.TimerSentry.
a new sentry that collects metrics after the current sentry behavior