Package com.tnsai.protocols.handlers
Class RequestReplyHandler
java.lang.Object
com.tnsai.protocols.handlers.AbstractProtocolHandler
com.tnsai.protocols.handlers.RequestReplyHandler
- All Implemented Interfaces:
ProtocolHandler
Handler for synchronous request-reply messaging.
Blocks until reply is received or timeout occurs.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.tnsai.protocols.handlers.ProtocolHandler
ProtocolHandler.HandlerCallback, ProtocolHandler.HandlerException -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintGets number of pending replies.longGets the timeout in milliseconds.voidhandleReply(com.tnsai.protocols.models.Message reply) Handles incoming reply message.com.tnsai.protocols.models.Messagesend(com.tnsai.protocols.models.Message message) Sends a message using this protocol.voidsendAsync(com.tnsai.protocols.models.Message message, ProtocolHandler.HandlerCallback callback) Sends a message asynchronously.Methods inherited from class com.tnsai.protocols.handlers.AbstractProtocolHandler
getTransport, isRunning, start, stop
-
Constructor Details
-
RequestReplyHandler
-
-
Method Details
-
send
public com.tnsai.protocols.models.Message send(com.tnsai.protocols.models.Message message) throws ProtocolHandler.HandlerException Description copied from interface:ProtocolHandlerSends a message using this protocol.- Parameters:
message- Message to send- Returns:
- Response message (null for async protocols)
- Throws:
ProtocolHandler.HandlerException- if send fails
-
sendAsync
public void sendAsync(com.tnsai.protocols.models.Message message, ProtocolHandler.HandlerCallback callback) Description copied from interface:ProtocolHandlerSends a message asynchronously.- Parameters:
message- Message to sendcallback- Callback for response
-
handleReply
public void handleReply(com.tnsai.protocols.models.Message reply) Handles incoming reply message. Called by transport layer when reply is received.- Parameters:
reply- Reply message
-
getTimeoutMillis
public long getTimeoutMillis()Gets the timeout in milliseconds.- Returns:
- Timeout value
-
getPendingCount
public int getPendingCount()Gets number of pending replies.- Returns:
- Pending count
-