Example usage for org.springframework.batch.core.launch NoSuchJobExecutionException printStackTrace

List of usage examples for org.springframework.batch.core.launch NoSuchJobExecutionException printStackTrace

Introduction

In this page you can find the example usage for org.springframework.batch.core.launch NoSuchJobExecutionException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

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

Usage

From source file:uk.ac.ebi.intact.editor.controller.admin.AdminJobController.java

public void stop(ActionEvent evt) {
    UIParameter param = (UIParameter) evt.getComponent().getChildren().iterator().next();
    long executionId = (Long) param.getValue();

    try {//from  ww  w. j av a 2s.co  m
        getPsiMIJobManager().getJobOperator().stop(executionId);

        addInfoMessage("Job stopped", "Execution ID: " + executionId);
    } catch (NoSuchJobExecutionException e) {
        addErrorMessage("Job does not exist " + e.getMessage(), "Execution ID: " + executionId);
        e.printStackTrace();
    } catch (JobExecutionNotRunningException e) {
        addErrorMessage("Job is not running anymore " + e.getMessage(), "Execution ID: " + executionId);
        e.printStackTrace();
    }
}

From source file:uk.ac.ebi.intact.editor.controller.dbmanager.ImportJobController.java

public void stop(ActionEvent evt) {
    UIParameter param = (UIParameter) evt.getComponent().getChildren().iterator().next();
    long executionId = (Long) param.getValue();

    try {/*from ww  w  .  j a  va 2  s  .co  m*/
        getPsiMIJobManager().getJobOperator().stop(executionId);

        addInfoMessage("Job stopped", "Execution ID: " + executionId);
    } catch (NoSuchJobExecutionException e) {
        addErrorMessage("Job does not exist: " + e.getMessage(), "Execution ID: " + executionId);
        e.printStackTrace();
    } catch (JobExecutionNotRunningException e) {
        addErrorMessage("Job is not running anymore: " + e.getMessage(), "Execution ID: " + executionId);
        e.printStackTrace();
    }
}

From source file:uk.ac.ebi.intact.editor.controller.dbmanager.ImportJobController.java

public void stopAndDiscardImport(ActionEvent evt) {

    if (!evt.getComponent().getChildren().isEmpty()) {
        UIParameter param = (UIParameter) evt.getComponent().getChildren().iterator().next();

        long executionId = (Long) param.getValue();

        try {//from   w w w. j av  a  2 s  .  c  om
            getPsiMIJobManager().getJobOperator().stop(executionId);

            addInfoMessage("Job stopped", "Execution ID: " + executionId);
        } catch (NoSuchJobExecutionException e) {
            addErrorMessage("Job does not exist: " + e.getMessage(), "Execution ID: " + executionId);
            e.printStackTrace();
        } catch (JobExecutionNotRunningException e) {
            addErrorMessage("Job is not running anymore: " + e.getMessage(), "Execution ID: " + executionId);
            e.printStackTrace();
        }

        JobExecution execution = getJobExplorer().getJobExecution(executionId);

        if (execution != null) {
            JobParameters params = execution.getJobParameters();
            if (params != null) {
                String jobId = params.getString("MIJobId");

                try {
                    getDbImportService().deleteImportedFeatures(jobId);

                    getDbImportService().deleteImportedParticipants(jobId);

                    getDbImportService().deleteImportedInteractions(jobId);

                    getDbImportService().deleteImportedExperiments(jobId);

                    getDbImportService().deleteImportedPublications(jobId);

                    getDbImportService().deleteImportedOrganisms(jobId);

                    getDbImportService().deleteImportedSources(jobId);

                    getDbImportService().deleteImportedCvs(jobId);

                    getBatchJobService().deleteJob(executionId);

                    addInfoMessage("Job cleared, import objects deleted", "Execution ID: " + executionId);
                } catch (Throwable e) {
                    addErrorMessage("Cannot clear job import " + e.getMessage(),
                            "Execution ID: " + executionId + ", " + ExceptionUtils.getFullStackTrace(e));
                }

                String errorFileName = params.getString("error.file");
                String fileName = params.getString("input.file");

                File file = new File(fileName);
                if (file.exists()) {
                    file.delete();
                }
                File errorFile = new File(errorFileName);
                if (errorFile.exists()) {
                    errorFile.delete();
                }
            }
        }
    }
}