JBoss Remoting 3.0.0.Beta2

org.jboss.remoting.spi
Interface RequestHandler

All Superinterfaces:
AutoCloseable<RequestHandler>, Closeable, HandleableCloseable<RequestHandler>

public interface RequestHandler
extends AutoCloseable<RequestHandler>

A request handler, which can be passed to remote endpoints. Remote systems can then use the handler to make invocations, or they may forward a handler on to other remote systems.

This is an internal Remoting interface, intended to be implemented only by Remoting internals and protocol implementations. It should not be implemented by end-users, as members may be added without notice. Applications should instead use the Client and RequestListener interfaces.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.jboss.remoting.HandleableCloseable
HandleableCloseable.Key
 
Method Summary
 HandleableCloseable.Key addCloseHandler(CloseHandler<? super RequestHandler> handler)
          Add a handler that is called when the request handler is closed.
 void close()
          Close this request handler.
 Handle<RequestHandler> getHandle()
          Get a handle to this request handler.
 RemoteRequestContext receiveRequest(Object request, ReplyHandler replyHandler)
          Receive a request from a remote system.
 

Method Detail

receiveRequest

RemoteRequestContext receiveRequest(Object request,
                                    ReplyHandler replyHandler)
Receive a request from a remote system. This method is intended to be called by protocol handlers. If the request cannot be accepted for some reason, the ReplyHandler.handleException(java.io.IOException) method is called immediately.

Parameters:
request - the request
replyHandler - a handler for the reply
Returns:
a context which may be used to cancel the request

getHandle

Handle<RequestHandler> getHandle()
                                 throws IOException
Get a handle to this request handler. The request handler will not auto-close as long as there is at least one open handle. If a handle is "leaked", it will be closed automatically if/when the garbage collector invokes its Object.finalize() method, with a log message warning of the leak.

Specified by:
getHandle in interface AutoCloseable<RequestHandler>
Returns:
the handle
Throws:
IOException - if a handle could not be acquired

close

void close()
           throws IOException
Close this request handler. The outcome of any outstanding requests is not defined, though implementations should make an effort to cancel any outstanding requests.

Specified by:
close in interface Closeable
Specified by:
close in interface HandleableCloseable<RequestHandler>
Throws:
IOException - if the client endpoint could not be closed

addCloseHandler

HandleableCloseable.Key addCloseHandler(CloseHandler<? super RequestHandler> handler)
Add a handler that is called when the request handler is closed.

Specified by:
addCloseHandler in interface HandleableCloseable<RequestHandler>
Parameters:
handler - the handler to be called
Returns:
a key which may be used to later remove this handler

JBoss Remoting 3.0.0.Beta2

Copyright © 2008 JBoss, a division of Red Hat, Inc.