How to shut down Java RPC-Server cleanly

Hi folks,

we run a Java RPC-server that connects to an EntireX-broker. As we don’t have administrative rights to operate the broker, we can’t use the System Management Hub to deregister and cleanly shut down our server.

Is there a way to initiate the shut down from the Java-server-side?

cu,
Stefan

Is your Broker on the mainframe (z/OS)? Is the Broker protected by EntireX Security? What version of EntireX Communicator is the Broker running under?

If EntireX Security is not being used, you can shut down a server from SMH. If you are running EXX721 or above with EntireX Security, it depends on the security rules established for the class/server/service whether you can shut down a service or not. Below EXX721, with EntireX Security, you would need access to the SAG.ETBCIS.CMD service in order to shut down any service. Above that level, you also need to logon to SMH with an account that has Register authority (eg for RACF, you need Control access to the class.server.service; for ACF2 you need Delete authority) - same level as required to register the server.

For Windows, if you configure the Java RPC Server as a Windows Service, you can start and stop the server from the Windows Services control panel. See “Operation and Monitoring of the Java RPC Server under Windows” for information on how to configure the service.

Hi Douglas,

unfortunately we don’t have too much information about the broker as it is run and operated by another company. As far as I know they use EntireX-Communicator 7.1.1.60 on a BS2000-mainframe.

We just provide a Java-RPC-Server that will be run as a Windows Service on a Win2k-Blade.

For this reason we can’t use SMH to deregister and shutdown our server correctly at the broker.

Our preferred way of deregistering the Java-RPC-Server would be to send a special data-package to the server that causes it to deregister from the broker and to perform a clean shutdown. For this reason I’d need some Java code example that shows how to deregister and stop the server from within the server-application.

Currently we do the shutdown by stopping the Windows Service via the “net stop” command that is issued by a UC4-application (remote job control system) but it seems that from time to time the broker doesn’t recognize that there’s no more RPC-Server running.

cu,
Stefan

When you do a ’kill’ of a server it can take some time before Broker becomes aware of this particular server is not running anymore and remove the server and deregister the services offered by this server.

If the server is active in Broker sense (Broker has passed information to him), SERVER-NONACT has to expire before Broker assumes that this server is not active and remove/deregister him in Broker. In the meantime other requests to this server/service are queued and this may be what you notice as “broker doesn’t recognize that there’s no more RPC-Server running”. If you can decrease SERVER-NONACT it will shorten this gap.

If the serves was not active in Broker sense, Broker will try to send the first next request to this server. If Broker receives an error on this call he will immediately assume server is in error and remove/deregister him in Broker. If Broker does not receive an error on this call you will still have to wait for SERVER-NONACT to expire.

Best regards,

Mogens Lundqvist
S o f t w a r e A G N o r d i c A / S
Systems Engineer

Hi Mogens,

if I understand you correctly, we could stop our server just by using something like “System.exit(0);”. If the SERVER-NONACT has expired the broker deregisters our service automatically. Right?

Best regard,
Stefan

Hi Stefan,

Where do you issue “System.exit(0);” from? From your application? If yes, why not just issue a DEREGISTER and LOGOFF just before you end your application?

If Broker has given control to your server and your server never returns to Broker again (either it decides to end w/o notifying Broker, abends or is canceled), Broker will deregister your services after SERVER-NONACT expires.

Hope this helps.

Mogens Lundqvist
S o f t w a r e A G N o r d i c A / S
Systems Engineer

Hi Stefan,

I’m not quit sure if I understood what you want to achieve. Should the Java RPC Server terminate itself ? How does the RPC Server knows when to shutdown ?

Some possible solutions to shutdown a RPC Server from the outside can be found in the threads http://entirex.forums.softwareag.com/viewtopic.php?t=233&fstart=50 and http://entirex.forums.softwareag.com/viewtopic.php?t=284 .

Hi Rolf,

our Java RPC server receives different messages. One type of message tells the server to shutdown, so the “System.exit(0);” is part of the server program, which currently works… But it doesn’t look elegant for me.

I’ll have a look at those two threads, especially at the file CISClient.zip.

cu,
Stefan