public class InvocationRegistry extends Object implements Iterable<Invocation>, MetricsProvider
Response
comes in, the
appropriate invocation can be looked up.
Some idea's:
- use an ringbuffer to store all invocations instead of a CHM. The call-id can be used as sequence-id for this
ringbuffer. It can be that you run in slots that have not been released; if that happens, just keep increasing
the sequence (although you now get sequence-gaps).
- pre-allocate all invocations. Because the ringbuffer has a fixed capacity, pre-allocation should be easy. Also
the PartitionInvocation and TargetInvocation can be folded into Invocation.Constructor and Description |
---|
InvocationRegistry(ILogger logger,
com.hazelcast.spi.impl.operationservice.impl.CallIdSequence callIdSequence) |
Modifier and Type | Method and Description |
---|---|
boolean |
deregister(Invocation invocation)
Deregisters an invocation.
|
Set<Map.Entry<Long,Invocation>> |
entrySet()
Intention to expose the entry set is to mutate it.
|
Invocation |
get(long callId)
Gets the invocation for the given call id.
|
Iterator<Invocation> |
iterator() |
void |
provideMetrics(MetricsRegistry registry) |
boolean |
register(Invocation invocation)
Registers an invocation.
|
void |
reset() |
void |
shutdown() |
int |
size()
Returns the number of pending invocations.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public InvocationRegistry(ILogger logger, com.hazelcast.spi.impl.operationservice.impl.CallIdSequence callIdSequence)
public void provideMetrics(MetricsRegistry registry)
provideMetrics
in interface MetricsProvider
public boolean register(Invocation invocation)
invocation
- The invocation to register.public boolean deregister(Invocation invocation)
false
.
This ensures the idempotence of deregistration.invocation
- The Invocation to deregister.true
if this call deregistered the invocation; false
if the invocation wasn't registeredpublic int size()
public Iterator<Invocation> iterator()
iterator
in interface Iterable<Invocation>
public Set<Map.Entry<Long,Invocation>> entrySet()
public Invocation get(long callId)
callId
- the callId.public void reset()
public void shutdown()
Copyright © 2017 Hazelcast, Inc.. All Rights Reserved.