public final class InvocationTracker extends Object
Constructor and Description |
---|
InvocationTracker(Channel channel)
Construct a new instance, using the maximum number of messages from the channel.
|
InvocationTracker(Channel channel,
int maxMessages)
Construct a new instance.
|
InvocationTracker(Channel channel,
int maxMessages,
IntUnaryOperator intMasker)
Construct a new instance.
|
InvocationTracker(Channel channel,
IntUnaryOperator intMasker)
Construct a new instance, using the maximum number of messages from the channel.
|
InvocationTracker(Channel channel,
MessageTracker messageTracker,
IntUnaryOperator intMasker)
Construct a new instance.
|
Modifier and Type | Method and Description |
---|---|
<T extends Invocation> |
addInvocation(IntFunction<T> producer)
Add an invocation to this tracker.
|
MessageOutputStream |
allocateMessage()
Allocate a message, possibly blocking until one is available.
|
MessageOutputStream |
allocateMessage(Invocation invocation)
Allocate a message on behalf of an invocation, possibly blocking until a message is available.
|
boolean |
containsIndex(int index)
Determine if the tracker contains an entry at the given index.
|
Invocation |
putIfAbsent(Invocation invocation)
Put an invocation into the tracker if there is none with the corresponding ID.
|
void |
remove(Invocation invocation)
Unconditionally remove an invocation from the map.
|
boolean |
signalResponse(int index,
int parameter,
MessageInputStream responseStream,
boolean remove)
Signal the arrival of a response with the given index.
|
public InvocationTracker(Channel channel, int maxMessages, IntUnaryOperator intMasker)
channel
- the channel that is being trackedmaxMessages
- the maximum number of concurrent messages to allowintMasker
- the function to apply to ID numbers to limit them to a specific rangepublic InvocationTracker(Channel channel, MessageTracker messageTracker, IntUnaryOperator intMasker)
channel
- the channel that is being trackedmessageTracker
- the message tracker to useintMasker
- the function to apply to ID numbers to limit them to a specific rangepublic InvocationTracker(Channel channel, IntUnaryOperator intMasker)
channel
- the channel that is being trackedintMasker
- the function to apply to ID numbers to limit them to a specific rangepublic InvocationTracker(Channel channel, int maxMessages)
channel
- the channel that is being trackedmaxMessages
- the maximum number of concurrent messages to allowpublic InvocationTracker(Channel channel)
channel
- the channel that is being trackedpublic <T extends Invocation> T addInvocation(IntFunction<T> producer)
T
- the invocation typeproducer
- the invocation producer, which may be called more than oncepublic boolean containsIndex(int index)
index
- the indextrue
if the tracker contains the entry, false
otherwisepublic Invocation putIfAbsent(Invocation invocation)
invocation
- the invocationnull
if the put was successfulpublic boolean signalResponse(int index, int parameter, MessageInputStream responseStream, boolean remove)
index
- the index of the responseparameter
- an integer parameter to pass to the response handler (typically a message ID type)responseStream
- the response streamremove
- true
to release the index for subsequent invocations, false
otherwisetrue
if the index was valid, false
otherwisepublic void remove(Invocation invocation)
invocation
- the invocationpublic MessageOutputStream allocateMessage() throws IOException
IOException
- if an error occurspublic MessageOutputStream allocateMessage(Invocation invocation) throws IOException
invocation
- the invocation of the messageIOException
- if an error occursCopyright © 2020 JBoss by Red Hat. All rights reserved.