Package org.jboss.remoting3.util
Class BlockingInvocation
- java.lang.Object
-
- org.jboss.remoting3.util.Invocation
-
- org.jboss.remoting3.util.BlockingInvocation
-
public class BlockingInvocation extends Invocation
A blocking invocation. This class may be used as-is or subclassed for additional functionality.- Author:
- David M. Lloyd
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
BlockingInvocation.Response
An invocation response for a blocking invocation.
-
Constructor Summary
Constructors Constructor Description BlockingInvocation(int index)
Construct a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cancel()
Cancel the invocation, causing all future responses to be closed without being read.BlockingInvocation.Response
getResponse()
Get the next queued response, waiting if necessary.void
handleClosed()
Handle closure of the channel.void
handleException(IOException exception)
Handle a failure that occurred on the channel while the invocation was outstanding.void
handleResponse(int parameter, MessageInputStream inputStream)
Handle a response on this invocation.-
Methods inherited from class org.jboss.remoting3.util.Invocation
getIndex
-
-
-
-
Method Detail
-
getResponse
public BlockingInvocation.Response getResponse() throws InterruptedException
Get the next queued response, waiting if necessary. The returned response must be closed.- Returns:
- the queued response
- Throws:
InterruptedException
- if the thread was interrupted while waiting
-
handleResponse
public void handleResponse(int parameter, MessageInputStream inputStream)
Description copied from class:Invocation
Handle a response on this invocation. The response may be final or it may be an update. Long tasks should be executed in a worker thread. This method must guarantee thatinputStream
is closed.- Specified by:
handleResponse
in classInvocation
- Parameters:
parameter
- the numeric parameter passed in to the trackerinputStream
- the body of the message
-
handleClosed
public void handleClosed()
Description copied from class:Invocation
Handle closure of the channel.- Specified by:
handleClosed
in classInvocation
-
handleException
public void handleException(IOException exception)
Description copied from class:Invocation
Handle a failure that occurred on the channel while the invocation was outstanding.- Specified by:
handleException
in classInvocation
- Parameters:
exception
- the exception that was thrown
-
cancel
public void cancel()
Cancel the invocation, causing all future responses to be closed without being read. This method should only be called from the waiting thread (for example, in response to thread interruption).
-
-