| Modifier and Type | Field and Description |
|---|---|
protected boolean |
closed
Whether the associated
Session has been closed |
protected long |
requestTimeout
The timeout in milliseconds
|
protected Class<T> |
responseClass
The expected response
Class |
protected Channel.ResultProcessorResult<T> |
result
|
protected Session |
session
The
Session if one applies |
| Constructor and Description |
|---|
ResultProcessor(Session session,
Class<T> responseClass,
long requestTimeout)
Creates a new instance using the specified parameters.
|
| Modifier and Type | Method and Description |
|---|---|
Channel.ResultProcessorResult<T> |
get()
Returns the
Channel.ResultProcessorResult when it is due. |
Session |
getSession() |
void |
process(String jsonMSG)
Processes the specified message that has been routed to this
Channel.ResultProcessor by its request ID. |
void |
sessionClosed()
Called if the
Session linked to this Channel.ResultProcessor
is closed. |
protected final long requestTimeout
protected boolean closed
Session has been closedprotected Channel.ResultProcessorResult<T extends Response> result
public ResultProcessor(@Nullable Session session, @Nonnull Class<T> responseClass, long requestTimeout)
session - the Session if one applies to the request.responseClass - the expected response class.requestTimeout - the timeout value in milliseconds.public void sessionClosed()
Session linked to this Channel.ResultProcessor
is closed.public void process(String jsonMSG) throws com.fasterxml.jackson.databind.JsonMappingException, com.fasterxml.jackson.core.JsonProcessingException
Channel.ResultProcessor by its request ID.jsonMSG - the message content formatted as JSON.com.fasterxml.jackson.databind.JsonMappingException - If the JSON mapping fails.com.fasterxml.jackson.core.JsonProcessingException - If the JSON can't be processed.@Nonnull public Channel.ResultProcessorResult<T> get() throws InterruptedException, TimeoutException, CastException
Channel.ResultProcessorResult when it is due. If the
response hasn't been received yet, this method will block until it is
or the timeout expires.InterruptedException - If the thread is interrupted while
waiting for the response.TimeoutException - If waiting for the response times out.CastException - If the Session is closed while waiting
for the response.@Nullable public Session getSession()
Session tied to this Channel.ResultProcessor, if
any.Copyright © 2022. All rights reserved.