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,
CallIdSequence callIdSequence,
int concurrencyLevel) |
Modifier and Type | Method and Description |
---|---|
void |
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 metricsRegistry) |
boolean |
register(Invocation invocation)
Registers an invocation.
|
void |
reset() |
void |
shutdown() |
int |
size()
Returns the number of pending invocations.
|
public InvocationRegistry(ILogger logger, CallIdSequence callIdSequence, int concurrencyLevel)
public void provideMetrics(MetricsRegistry metricsRegistry)
provideMetrics
in interface MetricsProvider
public boolean register(Invocation invocation)
invocation
- The invocation to register.public void deregister(Invocation invocation)
invocation
- The Invocation to deregister.public 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 © 2016 Hazelcast, Inc.. All Rights Reserved.