Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.1 » MobiLink - Server Administration » MobiLink Server APIs » Writing synchronization scripts in Java » MobiLink server API for Java reference


ShutdownListener interface


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, 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());
        catch(Exception e) {
            // Print some error output to the MobiLink log.
        // ...

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));

shutdownPerformed method