The easiest way to invoke an action manually is to telnet to the specified port and then type the single command key. telnet localhost 9999
, for example.
Valid commands include:
This application will work even in most deadlock situations because the thread is in issolation from the rest of the application. If the JVM is truely hung, this class will fail to accept connections but the Wrapper itself will detect the hang and restart the JVM externally.
The following code can be used in your application to start up the WrapperActionServer with all default actions enabled:
int port = 9999; WrapperActionServer server = new WrapperActionServer( port ); server.enableShutdownAction( true ); server.enableHaltExpectedAction( true ); server.enableRestartAction( true ); server.enableThreadDumpAction( true ); server.enableHaltUnexpectedAction( true ); server.enableAccessViolationAction( true ); server.enableAppearHungAction( true ); server.start();Then remember to stop the server when your application shuts down:
server.stop();@author Leif Mortenson
|
|