Package org.acplt.oncrpc.apps.jportmap
Class OncRpcEmbeddedPortmap
- java.lang.Object
-
- org.acplt.oncrpc.apps.jportmap.OncRpcEmbeddedPortmap
-
public class OncRpcEmbeddedPortmap extends java.lang.ObjectThe classOncRpcEmbeddedPortmapprovides 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) classOncRpcEmbeddedPortmap.embeddedjportmapExtend the portmap service so that it automatically takes itself out of service when the last ONC/RPC programs is deregistered.(package private) classOncRpcEmbeddedPortmap.OncRpcEmbeddedPortmapThreadThe classOncRpcEmbeddedPortmapThreadimplements a thread which will run an embedded portmap service.
-
Field Summary
Fields Modifier and Type Field Description protected OncRpcEmbeddedPortmap.embeddedjportmapembeddedPortmapPortmap object acting as embedded portmap service ornullif no embedded portmap service is necessary because the operating system already supplies one or another portmapper is already running.protected java.lang.ThreadembeddedPortmapThreadReferences thread object running the embedded portmap service.
-
Constructor Summary
Constructors Constructor Description OncRpcEmbeddedPortmap()Constructs an embeddable portmap service of classOncRpcEmbeddedPortmapand starts the service if no other (external) portmap service is available.OncRpcEmbeddedPortmap(int checkTimeout)Constructs an embeddable portmap service of classOncRpcEmbeddedPortmapand 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 booleanembeddedPortmapInUse()Indicates whether the embedded portmap service is in use.jportmapgetEmbeddedPortmap()Returns object implementing the embedded portmap service.java.lang.ThreadgetEmbeddedPortmapServiceThread()Returns the thread object running the embedded portmap service.static booleanisPortmapRunning()Indicates whether a portmap service (regardless whether it's supplied by the operating system or an embedded portmap service) is currently running.static booleanisPortmapRunning(int checkTimeout)Indicates whether a portmap service (regardless whether it's supplied by the operating system or an embedded portmap service) is currently running.voidshutdown()Stop the embedded portmap service if it is running.
-
-
-
Field Detail
-
embeddedPortmap
protected OncRpcEmbeddedPortmap.embeddedjportmap embeddedPortmap
Portmap object acting as embedded portmap service ornullif 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.IOExceptionConstructs an embeddable portmap service of classOncRpcEmbeddedPortmapand starts the service if no other (external) portmap service is available. This constructor is the same asOncRpcEmbeddedPortmapcalling with a timeout of 3 seconds.The constructor starts the portmap service in its own thread and then returns.
- Throws:
OncRpcExceptionjava.io.IOException- See Also:
embeddedPortmapInUse()
-
OncRpcEmbeddedPortmap
public OncRpcEmbeddedPortmap(int checkTimeout) throws OncRpcException, java.io.IOExceptionConstructs an embeddable portmap service of classOncRpcEmbeddedPortmapand 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:
OncRpcExceptionjava.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
nullif no embedded portmap service has been started.
-
getEmbeddedPortmap
public jportmap getEmbeddedPortmap()
Returns object implementing the embedded portmap service.- Returns:
- Embedded portmap object or
nullif 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.
-
-