public final class CallIdSequenceWithBackpressure extends Object implements CallIdSequence
CallIdSequence
that provides backpressure by taking
the number of in-flight operations into account when before creating a new call-id.
It is possible to temporarily create more concurrent invocations than the declared capacity due to:
Constructor and Description |
---|
CallIdSequenceWithBackpressure(int maxConcurrentInvocations,
long backoffTimeoutMs) |
Modifier and Type | Method and Description |
---|---|
void |
complete()
Not idempotent: must be called exactly once per invocation.
|
long |
forceNext()
Generates the next unique call ID.
|
long |
getLastCallId()
Returns the last issued call ID.
|
int |
getMaxConcurrentInvocations()
Returns the maximum concurrent invocations supported.
|
long |
next()
Generates the next unique call ID.
|
public CallIdSequenceWithBackpressure(int maxConcurrentInvocations, long backoffTimeoutMs)
public long getLastCallId()
CallIdSequence
getLastCallId
in interface CallIdSequence
public int getMaxConcurrentInvocations()
CallIdSequence
getMaxConcurrentInvocations
in interface CallIdSequence
public long next() throws TimeoutException
CallIdSequence
next
in interface CallIdSequence
TimeoutException
- if the outstanding invocation count hasn't dropped below the configured limit
within the configured timeoutpublic void complete()
CallIdSequence
complete
in interface CallIdSequence
public long forceNext()
CallIdSequence
forceNext
in interface CallIdSequence
Copyright © 2017 Hazelcast, Inc.. All Rights Reserved.