Example usage for org.springframework.batch.core.launch.support JobRegistryBackgroundJobRunner getErrors

List of usage examples for org.springframework.batch.core.launch.support JobRegistryBackgroundJobRunner getErrors

Introduction

In this page you can find the example usage for org.springframework.batch.core.launch.support JobRegistryBackgroundJobRunner getErrors.

Prototype

public static List<Exception> getErrors() 

Source Link

Document

Public getter for the startup errors encountered during parent context creation.

Usage

From source file:org.springframework.batch.sample.launch.RemoteLauncherTests.java

private static boolean isConnected() throws Exception {
    boolean connected = false;

    if (!JobRegistryBackgroundJobRunner.getErrors().isEmpty()) {
        throw JobRegistryBackgroundJobRunner.getErrors().get(0);
    }//  w  w w  .java2s  . co  m

    if (launcher == null) {
        MBeanServerConnectionFactoryBean connectionFactory = new MBeanServerConnectionFactoryBean();

        try {
            launcher = (JobOperator) getMBean(connectionFactory, "spring:service=batch,bean=jobOperator",
                    JobOperator.class);
            loader = (JobLoader) getMBean(connectionFactory, "spring:service=batch,bean=jobLoader",
                    JobLoader.class);
        } catch (MBeanServerNotFoundException e) {
            return false;
        }
    }

    try {
        launcher.getJobNames();
        connected = loader.getConfigurations().size() > 0;
        logger.info("Configurations loaded: " + loader.getConfigurations());
    } catch (InvalidInvocationException e) {
        // ignore
    }
    return connected;
}