org.acplt.oncrpc.server
Class OncRpcServerStub

java.lang.Object
  |
  +--org.acplt.oncrpc.server.OncRpcServerStub

public abstract class OncRpcServerStub
extends java.lang.Object

The abstract OncRpcServerStub class is the base class to build ONC/RPC-program specific servers upon. This class is typically only used by jrpcgen generated servers, which provide a particular set of remote procedures as defined in a x-file.


Field Summary
protected  java.lang.Object shutdownSignal
          Notification flag for signalling the server to stop processing incomming remote procedure calls and to shut down.
 
Constructor Summary
OncRpcServerStub()
           
 
Method Summary
protected  void close(OncRpcServerTransport[] transports)
          Close all transports listed in a set of server transports.
protected  void register(OncRpcServerTransport[] transports)
          Register a set of server transports with the local portmapper.
protected  void run(OncRpcServerTransport[] transports)
          Process incomming remote procedure call requests from all specified transports.
 void stopRpcProcessing()
          Notify the RPC server to stop processing of remote procedure call requests as soon as possible.
protected  void unregister(OncRpcServerTransport[] transports)
          Unregister a set of server transports from the local portmapper.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

shutdownSignal

protected java.lang.Object shutdownSignal
Notification flag for signalling the server to stop processing incomming remote procedure calls and to shut down.
Constructor Detail

OncRpcServerStub

public OncRpcServerStub()
Method Detail

register

protected void register(OncRpcServerTransport[] transports)
                 throws OncRpcException
Register a set of server transports with the local portmapper.
Parameters:
transports - Array of server transport objects to register, which will later handle incomming remote procedure call requests.
Throws:
OncRpcException - if the portmapper could not be contacted successfully.

run

protected void run(OncRpcServerTransport[] transports)
Process incomming remote procedure call requests from all specified transports. To end processing and to shut the server down signal the shutdownSignal object. Note that the thread on which run() is called will ignore any interruptions and will silently swallow them.
Parameters:
transports - Array of server transport objects for which processing of remote procedure call requests should be done.

stopRpcProcessing

public void stopRpcProcessing()
Notify the RPC server to stop processing of remote procedure call requests as soon as possible. Note that each transport has its own thread, so processing will not stop before the transports have been closed by calling the close(org.acplt.oncrpc.server.OncRpcServerTransport[]) method of the server.

unregister

protected void unregister(OncRpcServerTransport[] transports)
                   throws OncRpcException
Unregister a set of server transports from the local portmapper.
Parameters:
transports - Array of server transport objects to unregister.
Throws:
OncRpcException - with a reason of OncRpcException.RPC_FAILED if the portmapper could not be contacted successfully. Note that it is not considered an error to remove a non-existing entry from the portmapper.

close

protected void close(OncRpcServerTransport[] transports)
Close all transports listed in a set of server transports. Only by calling this method processing of remote procedure calls by individual transports can be stopped. This is because every server transport is handled by its own thread.
Parameters:
transports - Array of server transport objects to close.