Why doesn't the MvsCommandCallback class allow me to intercept STOP commands? Would be nice to have an opportunity to shut down cleanly in response to a STOP.
The current implementation seems to just take the JVM down unconditionally by calling System.exit().
I'm aware that malicious code could decide to just ignore the STOP request, but the operator could still issue a CANCEL in this case, so...
Any opinions?
MvsCommandCallback and STOP command
You can use the method java.lang.Runtime.addShutdownHook() to register code that runs at System.exit(). This, for example, is how Tomcat cleanly shuts everything down when you issue an MVS STOP command (on on other platforms, when you press cntl-c or send it a STOP signal).
Please let us know if this doesn't meet your requirements. I'm open to also consider registering a callback for STOP commands in JZOS.
Please let us know if this doesn't meet your requirements. I'm open to also consider registering a callback for STOP commands in JZOS.
Thanks for the quick reply.Anonymous wrote:You can use the method java.lang.Runtime.addShutdownHook() to register code that runs at System.exit(). This, for example, is how Tomcat cleanly shuts everything down when you issue an MVS STOP command (on on other platforms, when you press cntl-c or send it a STOP signal).
Please let us know if this doesn't meet your requirements. I'm open to also consider registering a callback for STOP commands in JZOS.
Yes, using the JVM shutdown hook is an option. Still, I'd like to register a callback because it would give us the opportunity to warn the operator ("Users still active -- use STOP FORCE to terminate anyway"). Suggestion: JZOS looks at the STOP parm; if it's "FORCE" the JVM is terminated unconditionally, else callback is invoked.
Cheers, Uli