public class CompositePoolLimitDeterminationStrategy extends java.lang.Object implements PoolLimitDeterminationStrategy
NO_DURATION, NO_ERROR, NO_TIME_UNIT, NO_VALUE
Constructor and Description |
---|
CompositePoolLimitDeterminationStrategy(PoolLimitDeterminationStrategy... strategies) |
Modifier and Type | Method and Description |
---|---|
boolean |
acquireCreationPermit(long acquireStartTime,
java.util.concurrent.TimeUnit timeUnit)
Attempts to acquire a creation permit.
|
int |
getAvailablePermits()
Returns the minimum number of permits available across all strategies.
|
void |
onCompleted()
Marks the end of all event callbacks.
|
void |
onEvent(ClientMetricsEvent<?> event,
long duration,
java.util.concurrent.TimeUnit timeUnit,
java.lang.Throwable throwable,
java.lang.Object value)
Event callback for any
MetricsEvent . |
void |
onSubscribe()
A callback when this listener is subscribed to a
MetricEventsPublisher . |
public CompositePoolLimitDeterminationStrategy(PoolLimitDeterminationStrategy... strategies)
public boolean acquireCreationPermit(long acquireStartTime, java.util.concurrent.TimeUnit timeUnit)
PoolLimitDeterminationStrategy
acquireCreationPermit
in interface PoolLimitDeterminationStrategy
acquireStartTime
- The start time for the acquire process in milliseconds since epoch.timeUnit
- The timeunit for the acquire start time.true
if the permit was acquired, false
otherwise.public int getAvailablePermits()
getAvailablePermits
in interface PoolLimitDeterminationStrategy
public void onEvent(ClientMetricsEvent<?> event, long duration, java.util.concurrent.TimeUnit timeUnit, java.lang.Throwable throwable, java.lang.Object value)
MetricEventsListener
MetricsEvent
. The parameters passed are all the contextual information possible for
any event. There presence or absence will depend on the type of event.onEvent
in interface MetricEventsListener<ClientMetricsEvent<?>>
event
- Event for which this callback has been invoked. This will never be null
duration
- If the passed event is MetricsEvent.isTimed()
then the actual duration, else
MetricEventsListener.NO_DURATION
timeUnit
- The time unit for the duration, if exists, else MetricEventsListener.NO_TIME_UNIT
throwable
- If the passed event is MetricsEvent.isError()
then the cause of the error, else
MetricEventsListener.NO_ERROR
value
- If the passed event requires custom object to be passed, then that object, else MetricEventsListener.NO_VALUE
public void onCompleted()
MetricEventsListener
onCompleted
in interface MetricEventsListener<ClientMetricsEvent<?>>
public void onSubscribe()
MetricEventsListener
MetricEventsPublisher
.onSubscribe
in interface MetricEventsListener<ClientMetricsEvent<?>>