private class GenericMessagingTemplate.TemporaryReplyChannel extends java.lang.Object implements PollableChannel
Modifier and Type | Field and Description |
---|---|
private boolean |
hasReceived |
private boolean |
hasSendFailed |
private boolean |
hasTimedOut |
private Log |
logger |
private java.util.concurrent.CountDownLatch |
replyLatch |
private Message<?> |
replyMessage |
INDEFINITE_TIMEOUT
Modifier | Constructor and Description |
---|---|
private |
TemporaryReplyChannel() |
Modifier and Type | Method and Description |
---|---|
Message<?> |
receive()
Receive a message from this channel, blocking indefinitely if necessary.
|
Message<?> |
receive(long timeout)
Receive a message from this channel, blocking until either a message is available
or the specified timeout period elapses.
|
boolean |
send(Message<?> message)
Send a
Message to this channel. |
boolean |
send(Message<?> message,
long timeout)
Send a message, blocking until either the message is accepted or the
specified timeout period elapses.
|
void |
setSendFailed(boolean hasSendError) |
private final Log logger
private final java.util.concurrent.CountDownLatch replyLatch
private volatile Message<?> replyMessage
private volatile boolean hasReceived
private volatile boolean hasTimedOut
private volatile boolean hasSendFailed
public void setSendFailed(boolean hasSendError)
public Message<?> receive()
PollableChannel
receive
in interface PollableChannel
Message
or null
if interruptedpublic Message<?> receive(long timeout)
PollableChannel
receive
in interface PollableChannel
timeout
- the timeout in milliseconds or MessageChannel.INDEFINITE_TIMEOUT
.Message
or null
if the specified timeout
period elapses or the message reception is interruptedpublic boolean send(Message<?> message)
MessageChannel
Message
to this channel. If the message is sent successfully,
the method returns true
. If the message cannot be sent due to a
non-fatal reason, the method returns false
. The method may also
throw a RuntimeException in case of non-recoverable errors.
This method may block indefinitely, depending on the implementation.
To provide a maximum wait time, use MessageChannel.send(Message, long)
.
send
in interface MessageChannel
message
- the message to sendpublic boolean send(Message<?> message, long timeout)
MessageChannel
send
in interface MessageChannel
message
- the message to sendtimeout
- the timeout in milliseconds or MessageChannel.INDEFINITE_TIMEOUT
true
if the message is sent, false
if not
including a timeout of an interrupt of the send