Class OncRpcEmbeddedPortmap


  • public class OncRpcEmbeddedPortmap
    extends java.lang.Object
    The class OncRpcEmbeddedPortmap provides an embeddable portmap service, which is automatically started in its own thread if the (operating) system does not already provide the portmap service. If an embedded portmap service is started it will stop only after the last ONC/RPC program has been deregistered.
    Version:
    $Revision: 1.2 $ $Date: 2003/08/14 08:00:08 $ $State: Exp $ $Locker: $
    Author:
    Harald Albrecht
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      (package private) class  OncRpcEmbeddedPortmap.embeddedjportmap
      Extend the portmap service so that it automatically takes itself out of service when the last ONC/RPC programs is deregistered.
      (package private) class  OncRpcEmbeddedPortmap.OncRpcEmbeddedPortmapThread
      The class OncRpcEmbeddedPortmapThread implements a thread which will run an embedded portmap service.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected OncRpcEmbeddedPortmap.embeddedjportmap embeddedPortmap
      Portmap object acting as embedded portmap service or null if no embedded portmap service is necessary because the operating system already supplies one or another portmapper is already running.
      protected java.lang.Thread embeddedPortmapThread
      References thread object running the embedded portmap service.
    • Constructor Summary

      Constructors 
      Constructor Description
      OncRpcEmbeddedPortmap()
      Constructs an embeddable portmap service of class OncRpcEmbeddedPortmap and starts the service if no other (external) portmap service is available.
      OncRpcEmbeddedPortmap​(int checkTimeout)
      Constructs an embeddable portmap service of class OncRpcEmbeddedPortmap and starts the service if no other (external) portmap service is available.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean embeddedPortmapInUse()
      Indicates whether the embedded portmap service is in use.
      jportmap getEmbeddedPortmap()
      Returns object implementing the embedded portmap service.
      java.lang.Thread getEmbeddedPortmapServiceThread()
      Returns the thread object running the embedded portmap service.
      static boolean isPortmapRunning()
      Indicates whether a portmap service (regardless whether it's supplied by the operating system or an embedded portmap service) is currently running.
      static boolean isPortmapRunning​(int checkTimeout)
      Indicates whether a portmap service (regardless whether it's supplied by the operating system or an embedded portmap service) is currently running.
      void shutdown()
      Stop the embedded portmap service if it is running.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • embeddedPortmap

        protected OncRpcEmbeddedPortmap.embeddedjportmap embeddedPortmap
        Portmap object acting as embedded portmap service or null if no embedded portmap service is necessary because the operating system already supplies one or another portmapper is already running.
      • embeddedPortmapThread

        protected java.lang.Thread embeddedPortmapThread
        References thread object running the embedded portmap service.
    • Constructor Detail

      • OncRpcEmbeddedPortmap

        public OncRpcEmbeddedPortmap()
                              throws OncRpcException,
                                     java.io.IOException
        Constructs an embeddable portmap service of class OncRpcEmbeddedPortmap and starts the service if no other (external) portmap service is available. This constructor is the same as OncRpcEmbeddedPortmap calling with a timeout of 3 seconds.

        The constructor starts the portmap service in its own thread and then returns.

        Throws:
        OncRpcException
        java.io.IOException
        See Also:
        embeddedPortmapInUse()
      • OncRpcEmbeddedPortmap

        public OncRpcEmbeddedPortmap​(int checkTimeout)
                              throws OncRpcException,
                                     java.io.IOException
        Constructs an embeddable portmap service of class OncRpcEmbeddedPortmap and starts the service if no other (external) portmap service is available.

        The constructor starts the portmap service in its own thread and then returns.

        Parameters:
        checkTimeout - timeout in milliseconds to wait before assuming that no portmap service is currently available.
        Throws:
        OncRpcException
        java.io.IOException
        See Also:
        embeddedPortmapInUse()
    • Method Detail

      • isPortmapRunning

        public static boolean isPortmapRunning()
        Indicates whether a portmap service (regardless whether it's supplied by the operating system or an embedded portmap service) is currently running. This method will check for 3 seconds for an answer from a portmap before assuming that no one exists.
        Returns:
        true, if a portmap service (either external or embedded) is running and can be contacted.
      • isPortmapRunning

        public static boolean isPortmapRunning​(int checkTimeout)
        Indicates whether a portmap service (regardless whether it's supplied by the operating system or an embedded portmap service) is currently running.
        Parameters:
        checkTimeout - timeout in milliseconds to wait before assuming that no portmap service is currently available.
        Returns:
        true, if a portmap service (either external or embedded) is running and can be contacted.
      • embeddedPortmapInUse

        public boolean embeddedPortmapInUse()
        Indicates whether the embedded portmap service is in use.
        Returns:
        true, if embedded portmap service is currently used.
      • getEmbeddedPortmapServiceThread

        public java.lang.Thread getEmbeddedPortmapServiceThread()
        Returns the thread object running the embedded portmap service.
        Returns:
        Thread object or null if no embedded portmap service has been started.
      • getEmbeddedPortmap

        public jportmap getEmbeddedPortmap()
        Returns object implementing the embedded portmap service.
        Returns:
        Embedded portmap object or null if no embedded portmap service has been started.
      • shutdown

        public void shutdown()
        Stop the embedded portmap service if it is running. Normaly you should not use this method except you need to force the embedded portmap service to terminate. Under normal conditions the thread responsible for the embedded portmap service will terminate automatically after the last ONC/RPC program has been deregistered.

        This method just signals the portmap thread to stop processing ONC/RPC portmap calls and to terminate itself after it has cleaned up after itself.