nl.grons.sentries.support

SentryBuilder

abstract class SentryBuilder extends AnyRef

Lots of code to make creating sentries trivially easy.

For usage instructions see nl.grons.sentries.SentrySupport.

Linear Supertypes
AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. SentryBuilder
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new SentryBuilder(owner: Class[_], resourceName: String, sentryRegistry: SentriesRegistry)

Abstract Value Members

  1. abstract def withSentry(andThenSentry: ChainableSentry): ChainableSentry with SentryBuilder

    Append a custom sentry to the current sentry.

    Append a custom sentry to the current sentry.

    andThenSentry

    the sentry to add

    returns

    a new sentry that applies the given sentry after the current sentry behavior

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  5. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  10. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  11. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  12. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  13. final def notify(): Unit

    Definition Classes
    AnyRef
  14. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  15. def registered(sentry: ChainableSentry): ChainableSentry

    Returns the registered instance of the sentry (when applicable).

    Returns the registered instance of the sentry (when applicable).

    Attributes
    protected
  16. val resourceName: String

  17. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  18. def toString(): String

    Definition Classes
    AnyRef → Any
  19. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  20. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  21. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  22. def withAdaptiveThroughput(targetSuccessRatio: Double = 0.95D, evaluationDelay: Duration = Duration(1, TimeUnit.SECONDS), minimumInvocationCountThreshold: Int = 0, successIncreaseFactor: Double = 1.2D): ChainableSentry with SentryBuilder

    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.

    targetSuccessRatio

    target success ratio, 0 < targetSuccessRatio < 1, defaults to 0.95

    evaluationDelay

    the time between calculations of the current throughput, defaults to 1 second

    minimumInvocationCountThreshold

    the minimum number of invocations that must be observed per evaluationDelay before invocations are throttled, defaults to 0 (>=0)

    successIncreaseFactor

    factor to apply to current throughput ratio, successIncreaseFactor > 1, defaults to 1.2D

    returns

    a new sentry that adaptively changes allowed throughput after the current sentry behavior

  23. def withConcurrencyLimit(concurrencyLimit: Int): ChainableSentry with SentryBuilder

    Append a concurrency limit sentry to the current sentry.

    Append a concurrency limit sentry to the current sentry.

    concurrencyLimit

    number of concurrently allowed invocations

    returns

    a new sentry that applies a concurrency limit after the current sentry behavior

  24. def withDurationLimit(durationLimit: Duration): ChainableSentry with SentryBuilder

    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.

    durationLimit

    the maximum duration of a call

    returns

    a new sentry that applies a duration limit after the current sentry behavior

  25. def withFailLimit(failLimit: Int, retryDelay: Duration = Duration(1, TimeUnit.SECONDS)): ChainableSentry with SentryBuilder

    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.

    failLimit

    number of failure after which the flow will be broken

    retryDelay

    timeout for trying again, defaults to 1 second

    returns

    a new sentry that applies a circuit breaker after the current sentry behavior

  26. def withFailLimitAndAdaptiveThroughput(failLimit: Int, retryDelay: Duration = Duration(1, TimeUnit.SECONDS), targetSuccessRatio: Double = 0.95D): ChainableSentry with SentryBuilder

    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.

    failLimit

    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

    retryDelay

    timeout for trying again (> 5 milliseconds), defaults to 1 second

    targetSuccessRatio

    target success ratio for adaptive throughput, 0 < targetSuccessRatio < 1, defaults to 0.95

    returns

    a new sentry that applies adaptive throughput after a circuit breaker after the current sentry behavior

  27. def withMetrics: ChainableSentry with SentryBuilder

    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.

    returns

    a new sentry that collects metrics after the current sentry behavior

  28. def withRateLimit(rate: Int, per: Duration): ChainableSentry with SentryBuilder

    Append a rate limit sentry to the current sentry.

    Append a rate limit sentry to the current sentry.

    rate

    number of invocations per time unit

    per

    the time unit

    returns

    a new sentry that applies a concurrency limit after the current sentry behavior

  29. def withTimer: ChainableSentry with SentryBuilder

    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.

    returns

    a new sentry that collects metrics after the current sentry behavior

Inherited from AnyRef

Inherited from Any

Ungrouped