public class GuardRail<Result extends java.lang.Enum<Result> & Failable,Rejected extends java.lang.Enum<Rejected>>
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
Rejected |
acquirePermits(long number)
Acquire permits for task execution.
|
Rejected |
acquirePermits(long number,
long nanoTime)
Acquire permits for task execution.
|
static <Result extends java.lang.Enum<Result> & Failable,Rejected extends java.lang.Enum<Rejected>> |
create(GuardRailProperties<Result,Rejected> properties) |
java.util.Map<java.lang.String,BackPressure<Rejected>> |
getBackPressure()
Return the backpressure map used by the GuardRail.
|
Clock |
getClock()
Return the clock the GuardRail will refer to for time.
|
java.lang.String |
getName()
Return the name of the GuardRail.
|
WritableCounts<Rejected> |
getRejectedCounts()
Return the rejected counts fort the GuardRail.
|
WritableCounts<Result> |
getResultCounts()
Return the result counts for the GuardRail.
|
WritableLatency<Result> |
getResultLatency()
Return the result latency for the GuardRail.
|
PrecipiceFunction<Result,ExecutionContext> |
releaseFunction()
Return a function that, when called with a result and execution context, will
release acquired permits.
|
void |
releasePermits(ExecutionContext context,
Result result)
Release acquired permits with known result.
|
void |
releasePermits(ExecutionContext context,
Result result,
long nanoTime)
Release acquired permits with known result.
|
void |
releasePermits(long number,
Result result,
long startNanos)
Release acquired permits with known result.
|
void |
releasePermits(long number,
Result result,
long startNanos,
long nanoTime)
Release acquired permits with known result.
|
void |
releasePermitsWithoutResult(long number)
Release acquired permits without result.
|
void |
releasePermitsWithoutResult(long number,
long nanoTime)
Release acquired permits without result.
|
public Rejected acquirePermits(long number)
number - of permits to acquirepublic Rejected acquirePermits(long number, long nanoTime)
number - of permits to acquirenanoTime - currentInterval nano timepublic void releasePermitsWithoutResult(long number)
number - of permits to releasepublic void releasePermitsWithoutResult(long number,
long nanoTime)
number - of permits to releasenanoTime - currentInterval nano timepublic void releasePermits(ExecutionContext context, Result result)
context - context of the task executionresult - of the executionpublic void releasePermits(ExecutionContext context, Result result, long nanoTime)
context - context of the task executionresult - of the executionnanoTime - currentInterval nano timepublic void releasePermits(long number,
Result result,
long startNanos)
number - of permits to releaseresult - of the executionstartNanos - of the executionpublic void releasePermits(long number,
Result result,
long startNanos,
long nanoTime)
number - of permits to releaseresult - of the executionstartNanos - of the executionnanoTime - currentInterval nano timepublic PrecipiceFunction<Result,ExecutionContext> releaseFunction()
public java.lang.String getName()
public WritableCounts<Result> getResultCounts()
public WritableCounts<Rejected> getRejectedCounts()
public WritableLatency<Result> getResultLatency()
public java.util.Map<java.lang.String,BackPressure<Rejected>> getBackPressure()
public Clock getClock()
public static <Result extends java.lang.Enum<Result> & Failable,Rejected extends java.lang.Enum<Rejected>> GuardRail<Result,Rejected> create(GuardRailProperties<Result,Rejected> properties)
Copyright © 2014 Tim Brooks. All Rights Reserved.