Class OncRpcServerStub

java.lang.Object
org.acplt.oncrpc.server.OncRpcServerStub
Direct Known Subclasses:
jportmap

public abstract class OncRpcServerStub extends 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.
Version:
$Revision: 1.2 $ $Date: 2003/08/14 13:47:04 $ $State: Exp $ $Locker: $
Author:
Harald Albrecht
  • Field Details

    • transports

      public OncRpcServerTransport[] transports
      Array containing ONC/RPC server transport objects which describe what transports an ONC/RPC server offers for handling ONC/RPC calls.
    • info

      Array containing program and version numbers tuples this server is willing to handle.
    • shutdownSignal

      protected Object shutdownSignal
      Notification flag for signalling the server to stop processing incomming remote procedure calls and to shut down.
    • characterEncoding

      private String characterEncoding
      Encoding to use when deserializing strings or null if the system's default encoding should be used.
  • Constructor Details

    • OncRpcServerStub

      public OncRpcServerStub()
  • Method Details

    • run

      public void run() throws OncRpcException, IOException
      All inclusive convenience method: register server transports with portmapper, then run the call dispatcher until the server is signalled to shut down, and finally deregister the transports.
      Throws:
      OncRpcException - if the portmapper can not be contacted successfully.
      IOException - if a severe network I/O error occurs in the server from which it can not recover (like severe exceptions thrown when waiting for now connections on a server socket).
    • register

      public 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

      public 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

      public 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

      public 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.
    • setCharacterEncoding

      public void setCharacterEncoding(String characterEncoding)
      Set the character encoding for deserializing strings.
      Parameters:
      characterEncoding - the encoding to use for deserializing strings. If null, the system's default encoding is to be used.
    • getCharacterEncoding

      public String getCharacterEncoding()
      Get the character encoding for deserializing strings.
      Returns:
      the encoding currently used for deserializing strings. If null, then the system's default encoding is used.