org.jboss.remoting.spi
Interface RequestHandlerSource

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

public interface RequestHandlerSource
extends AutoCloseable<RequestHandlerSource>

A request handler source, which can be passed to remote endpoints. Remote systems can then use the handler source to acquire request handlers, or they may pass it on to other systems. Acquiring a request handler using this method has the advantage that a round trip to the remote side is not necessary; the local side can spawn a request handler and simply notify the remote side of the change.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.jboss.remoting.HandleableCloseable
HandleableCloseable.Key
 
Method Summary
 HandleableCloseable.Key addCloseHandler(CloseHandler<? super RequestHandlerSource> handler)
          Add a handler that is called when the request handler source is closed.
 void close()
          Close this request handler source immediately.
 Handle<RequestHandler> createRequestHandler()
          Create a request handler for the service corresponding to this request handler source.
 Handle<RequestHandlerSource> getHandle()
          Get a handle to this request handler source.
 

Method Detail

createRequestHandler

Handle<RequestHandler> createRequestHandler()
                                            throws IOException
Create a request handler for the service corresponding to this request handler source.

Returns:
a request handler
Throws:
RemotingException - if a client could not be opened
IOException

getHandle

Handle<RequestHandlerSource> getHandle()
                                       throws IOException
Get a handle to this request handler source. The request handler source will not auto-close as long as there is at least one open handle, or request handler. 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<RequestHandlerSource>
Returns:
the handle
Throws:
RemotingException - if a handle could not be acquired
IOException

close

void close()
           throws IOException
Close this request handler source immediately.

Specified by:
close in interface Closeable
Specified by:
close in interface HandleableCloseable<RequestHandlerSource>
Throws:
IOException - if the close failed

addCloseHandler

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

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


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