Search in sources :

Example 1 with FlowDiagram

use of nl.nn.adapterframework.util.FlowDiagram in project iaf by ibissource.

the class IbisContext method init.

/**
 * Creates the Spring context, and load the configuration. Optionally  with
 * a specific ClassLoader which might for example override the getResource
 * method to load configuration and related resources from a different
 * location from the standard classpath. In case basePath is not null the
 * ClassLoader is wrapped in {@link BasePathClassLoader} to make it possible
 * to reference resources in the configuration relative to the configuration
 * file and have an extra resource override (resource is first resolved
 * relative to the configuration, when not found it is resolved by the
 * original ClassLoader.
 *
 * @see ClassUtils#getResourceURL(ClassLoader, String)
 * @see AppConstants#getInstance(ClassLoader)
 *
 * @param reconnect automatically try to reconnect to a datasource
 */
public synchronized void init(boolean reconnect) {
    try {
        long start = System.currentTimeMillis();
        LOG.info("Attempting to start IBIS application");
        MessageKeeper messageKeeper = new MessageKeeper();
        messageKeepers.put("*ALL*", messageKeeper);
        if (StringUtils.isNotEmpty(FLOW_CREATE_DIAGRAM_URL)) {
            flowDiagram = new FlowDiagram(FLOW_CREATE_DIAGRAM_URL);
        }
        applicationContext = createApplicationContext();
        ibisManager = (IbisManager) applicationContext.getBean("ibisManager");
        ibisManager.setIbisContext(this);
        classLoaderManager = new ClassLoaderManager(this);
        AbstractSpringPoweredDigesterFactory.setIbisContext(this);
        load();
        getMessageKeeper().setMaxSize(Math.max(messageKeeperSize, getMessageKeeper().size()));
        log("startup in " + (System.currentTimeMillis() - start) + " ms");
    } catch (Exception e) {
        // Catch all exceptions, the IBIS failed to startup...
        LOG.error("Failed to initialize IbisContext, retrying in 1 minute!", e);
        if (reconnect) {
            ibisContextReconnectThread = new Thread(new IbisContextRunnable(this));
            ibisContextReconnectThread.setName("ibisContextReconnectThread");
            ibisContextReconnectThread.start();
        }
    }
}
Also used : MessageKeeper(nl.nn.adapterframework.util.MessageKeeper) FlowDiagram(nl.nn.adapterframework.util.FlowDiagram) BeansException(org.springframework.beans.BeansException)

Aggregations

FlowDiagram (nl.nn.adapterframework.util.FlowDiagram)1 MessageKeeper (nl.nn.adapterframework.util.MessageKeeper)1 BeansException (org.springframework.beans.BeansException)1