Example usage for java.lang NoSuchMethodError printStackTrace

List of usage examples for java.lang NoSuchMethodError printStackTrace

Introduction

In this page you can find the example usage for java.lang NoSuchMethodError printStackTrace.

Prototype

public void printStackTrace(PrintStream s) 

Source Link

Document

Prints this throwable and its backtrace to the specified print stream.

Usage

From source file:org.jvnet.hudson.plugins.backup.utils.BackupTask.java

private void cancelNoJobs() {
    logger.info("Cancel hudson shutdown mode");
    try {//from w  w w.ja  v a  2s.c  om
        Hudson.getInstance().doCancelQuietDown();
    } catch (NoSuchMethodError e) {
        // nothing to do, this "hack" is there for the plugin to work with
        // Hudson 1.312
    } catch (Exception e) {
        logger.error("Erreur cancelling hudson shutdown mode.");
        e.printStackTrace(logger.getWriter());
    }
}

From source file:org.jvnet.hudson.plugins.backup.utils.BackupTask.java

private void waitNoJobsInQueue() {
    logger.info("Setting hudson in shutdown mode to avoid files corruptions.");
    try {/*  w ww  .  ja v  a2 s .  c o  m*/
        Hudson.getInstance().doQuietDown();
    } catch (NoSuchMethodError e) {
        // nothing to do, this "hack" is there for the plugin to work with
        // Hudson 1.312
    } catch (Exception e) {
        logger.error("Erreur putting hudson in shutdown mode.");
        e.printStackTrace(logger.getWriter());
    }

    logger.info("Waiting all jobs end...");

    Computer computer[] = Hudson.getInstance().getComputers();

    int running = 1;
    // TODO BACKUP-PLUGIN add timeout here
    while (running > 0) {
        running = 0;
        for (int i = 0; i < computer.length; i++) {
            running += computer[i].countBusy();
        }
        logger.info("Number of running jobs detected : " + running);

        try {
            Thread.sleep(DELAY);
        } catch (InterruptedException e) {
        }
    }

    logger.info("All jobs finished.");
}