Package org.acplt.oncrpc.apps.jportmap
Class OncRpcEmbeddedPortmap
java.lang.Object
org.acplt.oncrpc.apps.jportmap.OncRpcEmbeddedPortmap
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 ClassesModifier and TypeClassDescription(package private) class
Extend the portmap service so that it automatically takes itself out of service when the last ONC/RPC programs is deregistered.(package private) class
The classOncRpcEmbeddedPortmapThread
implements a thread which will run an embedded portmap service. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected OncRpcEmbeddedPortmap.embeddedjportmap
Portmap object acting as embedded portmap service ornull
if no embedded portmap service is necessary because the operating system already supplies one or another portmapper is already running.protected Thread
References thread object running the embedded portmap service. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs an embeddable portmap service of classOncRpcEmbeddedPortmap
and starts the service if no other (external) portmap service is available.OncRpcEmbeddedPortmap
(int checkTimeout) Constructs an embeddable portmap service of classOncRpcEmbeddedPortmap
and starts the service if no other (external) portmap service is available. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Indicates whether the embedded portmap service is in use.Returns object implementing the embedded portmap service.Returns the thread object running the embedded portmap service.static boolean
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.
-
Field Details
-
embeddedPortmap
Portmap object acting as embedded portmap service ornull
if no embedded portmap service is necessary because the operating system already supplies one or another portmapper is already running. -
embeddedPortmapThread
References thread object running the embedded portmap service.
-
-
Constructor Details
-
OncRpcEmbeddedPortmap
Constructs an embeddable portmap service of classOncRpcEmbeddedPortmap
and starts the service if no other (external) portmap service is available. This constructor is the same asOncRpcEmbeddedPortmap
calling with a timeout of 3 seconds.The constructor starts the portmap service in its own thread and then returns.
- Throws:
OncRpcException
IOException
- See Also:
-
OncRpcEmbeddedPortmap
Constructs an embeddable portmap service of classOncRpcEmbeddedPortmap
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
IOException
- See Also:
-
-
Method Details
-
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
Returns the thread object running the embedded portmap service.- Returns:
- Thread object or
null
if no embedded portmap service has been started.
-
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.
-