public abstract class CallIdSequence extends Object
next(Invocation)
, there is a matching complete(Invocation)
.
If this doesn't match, than either the number of concurrent invocations can grow or shrink over time. This can lead
to OOME or deadlock.
The CallIdSequence provides back pressure if enabled and there are too many concurrent invocations. When this happens,
an exponential backoff policy is applied.
Currently a single CallIdSequence is used for all partitions; so there is contention. Also one partition can cause problems
in other partition if a lot of invocations are created for that partition. Then other partitions can't make as many invocations
because a single callIdSequence is being used.
In the future we could add a CallIdSequence per partition or using some 'concurrency level' and do a mod based on the
partition-id. The advantage is that you reduce contention and improved isolation, at the expensive of:
Modifier and Type | Class and Description |
---|---|
static class |
CallIdSequence.CallIdSequenceWithBackpressure
A
CallIdSequence that provided backpressure by taking
the number in flight operations into account when a call-id needs to be determined. |
static class |
CallIdSequence.CallIdSequenceWithoutBackpressure |
Constructor and Description |
---|
CallIdSequence() |
Modifier and Type | Method and Description |
---|---|
abstract void |
complete(com.hazelcast.spi.impl.operationservice.impl.Invocation invocation) |
abstract int |
getMaxConcurrentInvocations()
Returns the maximum concurrent invocations supported.
|
abstract long |
next(com.hazelcast.spi.impl.operationservice.impl.Invocation invocation)
Creates the next call-id.
|
protected boolean |
skipRegistration(com.hazelcast.spi.impl.operationservice.impl.Invocation invocation)
Not every call needs to be registered.
|
public abstract int getMaxConcurrentInvocations()
public abstract long next(com.hazelcast.spi.impl.operationservice.impl.Invocation invocation)
Operation.CALL_ID_LOCAL_SKIPPED
is returned if local registration in
the InvocationRegistry can be skipped.invocation
- the Invocation to create a call-id for.AssertionError
- if invocation.op.callId not equals 0public abstract void complete(com.hazelcast.spi.impl.operationservice.impl.Invocation invocation)
protected boolean skipRegistration(com.hazelcast.spi.impl.operationservice.impl.Invocation invocation)
invocation
- Copyright © 2016 Hazelcast, Inc.. All Rights Reserved.