|
JBoss Remoting 3.1.0.Beta1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
I - the request typeO - the reply typepublic interface Client<I,O>

A communications client. The client may be associated with state maintained by the local and/or remote side.
This interface is part of the Remoting public API. It is intended to be consumed by Remoting applications; it is not intended to be implemented by them. Methods may be added to this interface in future minor releases without advance notice.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.jboss.remoting3.HandleableCloseable |
|---|
HandleableCloseable.Key |
| Method Summary | ||
|---|---|---|
O |
invoke(I request)
Send a request and block until a reply is received. |
|
|
invoke(I request,
Class<T> expectedResultType)
Send a reqest and block until a reply is received, requiring the reply to be of a specific type. |
|
|
invokeTyped(TypedRequest<? extends I,T> request)
Send a typed request and block until a reply is received. |
|
org.jboss.xnio.IoFuture<? extends O> |
send(I request)
Send a request asynchronously. |
|
|
send(I request,
Class<T> expectedResultType)
Send a request asynchronously, requiring the reply to be of a specific result type. |
|
|
sendTyped(TypedRequest<? extends I,T> request)
Send a typed request asynchronously. |
|
| Methods inherited from interface org.jboss.remoting3.HandleableCloseable |
|---|
addCloseHandler, awaitClosed, awaitClosedUninterruptibly, close |
| Methods inherited from interface org.jboss.remoting3.Attachable |
|---|
getAttachments |
| Method Detail |
|---|
O invoke(I request)
throws IOException,
CancellationException
CancellationException is thrown. This exception indicates
that the request was received and was executed, but a cancellation request was received and handled before the
reply was able to be sent. The remote service will have cleanly cancelled the operation. This exception type
is a RuntimeException; thus direct handling of this exception is optional (depending on your use case).
If the request is sent but the remote side sends an exception back, a RemoteExecutionException is thrown
with the cause and message initialized by the remote service. This exception indicates an error in the execution
of the service's RequestListener. The service will have cleanly recovered from such an exception.
If the request is sent and the remote side tries to reply, but sending the reply fails, a
RemoteReplyException is thrown, possibly with the cause initialized to the reason of the failure. Typically
this exception is thrown when serialization of the reply failed for some reason. This exception type extends
RemoteExecutionException and can be treated similarly in most cases.
If the request is sent and the remote side sends the reply successfully but there is an error reading the reply
locally, a ReplyException is thrown. In this case the operation is known to have completed without error
but the actual detailed reply cannot be known. In cases where the reply would be ignored anyway, this exception
type may be safely ignored (possibly logging it for informational purposes). This exception is typically caused
by an ObjectStreamException thrown while unmarshalling the reply, though other causes are also possible.
If the result of the operation is known to be impossible to ascertain, then an IndeterminateOutcomeException
is thrown. Possible causes of this condition include (but are not limited to) the connection to the remote side
being unexpectedly broken, or the current thread being interrupted before the reply can be read. In the latter
case, a best effort is automatically made to attempt to cancel the outstanding operation, though there is no
guarantee.
If the request cannot be sent, some other IOException will be thrown with the reason, including (but not limited to)
attempting to call this method on a closed client, or ObjectStreamExceptions related to marshalling the
request locally or unmarshalling it remotely. Such an exception indicates that the remote side did not receive
the request.
All these exceptions (apart from CancellationException) extend IOException which makes it easier
to selectively catch only those exceptions that you need to implement special policy for, while relegating the
rest to common handlers.
request - the request to send
CancellationException - if the operation was cancelled asynchronously
RemoteExecutionException - if the remote handler threw an exception
RemoteReplyException - if the remote side was unable to send the response
ReplyException - if the operation succeeded but the reply cannot be read for some reason
IndeterminateOutcomeException - if the result of the operation cannot be ascertained
ObjectStreamException - if marshalling or unmarshalling some part of the request failed
IOException - if some other I/O error occurred while sending the request
<T extends O> T invoke(I request,
Class<T> expectedResultType)
throws IOException,
CancellationException
invoke(I).
request - the reqest to sendexpectedResultType - the expected result type
IOException - if an I/O error occurred while sending the request
CancellationException - if the operation was cancelled asynchronouslyinvoke(I)
<T extends O> T invokeTyped(TypedRequest<? extends I,T> request)
throws IOException,
CancellationException,
ClassCastException
<I>, a ClassCastException is thrown. Otherwise this method functions
identically to invoke(I).
T - the specific reply subtyperequest - the request
IOException - if an I/O error occurred while sending the request
CancellationException - if the operation was cancelled asynchronously
ClassCastException
org.jboss.xnio.IoFuture<? extends O> send(I request)
throws IOException
IoFuture object can be queried at a later time
to determine the result of the operation. If the operation fails, one of the conditions described on the
invoke(I) method will result. This condition can be determined by reading the status of
the IoFuture object or by attempting to read the result.
request - the request to send
ObjectStreamException - if marshalling some part of the request failed
IOException - if some other I/O error occurred while sending the request
<T extends O> org.jboss.xnio.IoFuture<? extends T> send(I request,
Class<T> expectedResultType)
throws IOException
send(I).
T - the expected result typerequest - the request to sendexpectedResultType - the expected result type class
ObjectStreamException - if marshalling some part of the request failed
IOException - if some other I/O error occurred while sending the requestsend(I)
<T extends O> org.jboss.xnio.IoFuture<? extends T> sendTyped(TypedRequest<? extends I,T> request)
throws IOException
<I>, a ClassCastException is thrown. Otherwise
this method functions identically to send(I).
T - the expected result typerequest - the request to send
ObjectStreamException - if marshalling some part of the request failed
IOException - if some other I/O error occurred while sending the requestsend(I)
|
JBoss Remoting 3.1.0.Beta1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||