Example usage for javax.naming NameNotFoundException printStackTrace

List of usage examples for javax.naming NameNotFoundException printStackTrace

Introduction

In this page you can find the example usage for javax.naming NameNotFoundException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:com.cyberway.issue.crawler.Heritrix.java

/**
 * Prepars for program shutdown. This method does it's best to prepare the
 * program so that it can exit normally. It will kill the httpServer and
 * terminate any running job.<br>/*from ww  w.j a va2  s . c om*/
 * It is advisible to wait a few (~1000) millisec after calling this method
 * and before calling performHeritrixShutDown() to allow as many threads as
 * possible to finish what they are doing.
 */
public static void prepareHeritrixShutDown() {
    // Stop and destroy all running Heritrix instances.
    // Get array of the key set to avoid CCEs for case where call to
    // destroy does a remove of an instance from Heritrix.instances.
    final Object[] keys = Heritrix.instances.keySet().toArray();
    for (int i = 0; i < keys.length; i++) {
        ((Heritrix) Heritrix.instances.get(keys[i])).destroy();
    }

    try {
        deregisterJndi(getJndiContainerName());
    } catch (NameNotFoundException e) {
        // We were probably unbound already. Ignore.
        logger.log(Level.WARNING, "deregistration of jndi", e);
    } catch (Exception e) {
        e.printStackTrace();
    }

    if (Heritrix.httpServer != null) {
        // Shut down the web access.
        try {
            Heritrix.httpServer.stopServer();
        } catch (InterruptedException e) {
            // Generally this can be ignored, but we'll print a stack trace
            // just in case.
            e.printStackTrace();
        } finally {
            Heritrix.httpServer = null;
        }
    }
}