public ianywhere.ml.script.ShutdownListener
The listener interface for catching server shutdowns. Use this interface to ensure that all threads, connections, and other resources are cleaned up before the server exits
All members of ianywhere.ml.script.ShutdownListener, including all inherited members.
The following code installs a ShutdownListener for the ServerContext.
class MyShutdownListener implements ShutdownListener { FileOutputStream _outFile; public MySutdownListener(FileOutputStream outFile) { _outFile = outFile; } public void shutdownPerformed(ServerContext sc) { // Add shutdown code try { _outFile.write(("Shutting Down" + "\n").getBytes()); _outFile.flush(); } catch(Exception e) { // Print some error output to the MobiLink log. e.printStackTrace(); } // ... } } |
The following code registers MyShutdownListener. Call this code from anywhere that has access to the ServerContext such as a class constructor or synchronization script.
// ServerContext serv_context; // FileOutputStream outFile serv_context.addShutdownListener(new MyShutdownListener(outFile)); |
Discuss this page in DocCommentXchange. Send feedback about this page using email. |
Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1 |