|
Shutting down the Web NMS Server using API
Web NMS Server can be shut down using a remote API named ShutDownAPI. This API allows the configured users, who have the necessary permission to shut down the Web NMS BE or FE server. The Web NMS Shut down process takes care of shutting down all the sub-processes and properly releasing all the system resources. When the shut down operation is initiated through this API, it first authenticates the user and then checks if the user has the permission to invoke the shut down operation. Failing any of these checks the shut down operation is not allowed. When the authentication succeeds, the Web NMS Server is shut down.
How to use the ShutDown API ?
From the same JVM as that of the Web NMS server, handle to this API can be obtained by invoking the static getInstance method of the ShutDownAPIImpl class. You can shutdown the server including the web server from the server JVM by passing "true" to the shutDownNMSServer() method as shown in the below given code snippet.
|
ShutDownAPI shutdownAPI = (ShutDownAPI) com.adventnet.nms.admin.ShutDownAPIImpl.getInstance()shutDownNMSServer(true); |
From a remote JVM, handle to this API can be obtained by doing a RMI lookup with the RMI handle ShutDownAPI.
|
ShutDownAPI shutdownAPI = (ShutDownAPI) Naming.lookup("//ServerHost/ShutDownAPI"); |
If RMI Security is enabled for the Web NMS server, then ShutDownAPI handle can be obtained for remote JVMs by,
|
RMIAccessAPI rmiApi = (RMIAccessAPI) Naming.lookup ("//ServerHost/RMIAccessAPI"); ShutDownAPI shutdownAPI = (ShutDownAPI) rmiApi.getAPI ("username", "password", "ShutDownAPI"); |
For shutting down the Server, use the method shutDownServer available in ShutDownAPI.
|
String username; // the name of the configured user who initiates the shutdown operation String key; // The challenge key computed for the user name
shutdownAPI.shutDownServer(username, key); |
For calculating the challenge key, kindly refer to the following section of our help documentation :
Security Services--->Authentication
ShutDownObserver - Notification Mechanism
Web NMS provides a feature for getting notifications, when Web NMS server
is shut down. The method shutdown()
will be called, if you run a module with Web NMS implementing RunProcessInterface
. If you
have any other process running with Web NMS, which does not implement
RunProcessInterface in the same JVM, and if the process needs ShutDown
information, this feature will be of great help to the users.
ShutDownObserver
is an interface
for objects which needs to register to Web NMS server to get notified
when Web NMS server is shut down. The implementing class should get registered
for ShutDown using com.adventnet.nms.util.PureServerUtils.registerForShutDown(ShutDownObserver).
The applications can provide their own implementation to the shutDown() method and define their mechanisms to handle shut down of Web NMS Server. The method shutDown() of registered ShutDownObserver is called, whenever Web NMS server shuts down.
|