Search in sources :

Example 6 with AdapterManagerMBean

use of com.adaptris.core.runtime.AdapterManagerMBean in project interlok by adaptris.

the class UnifiedBootstrap method tryStart.

private void tryStart(Set<ObjectName> adapters) throws Exception {
    long timeout = bootstrapProperties.getOperationTimeout();
    for (ObjectName obj : adapters) {
        AdapterManagerMBean mgr = JMX.newMBeanProxy(JmxHelper.findMBeanServer(bootstrapProperties), obj, AdapterManagerMBean.class);
        try {
            if (Constants.DBG) {
                mgr.requestStart();
            } else {
                log.trace("Start operationTimeout : {}", DurationFormatUtils.formatDurationWords(timeout, true, true));
                mgr.requestStart(timeout);
            }
        } catch (CoreException | TimeoutException e) {
            mgr.requestClose(timeout);
            log.error("Failed to fully start [{}]; adapter closed to avoid inconsistent state", obj);
            throw e;
        }
    }
}
Also used : CoreException(com.adaptris.core.CoreException) AdapterManagerMBean(com.adaptris.core.runtime.AdapterManagerMBean) ObjectName(javax.management.ObjectName) TimeoutException(java.util.concurrent.TimeoutException)

Aggregations

AdapterManagerMBean (com.adaptris.core.runtime.AdapterManagerMBean)6 ObjectName (javax.management.ObjectName)4 Adapter (com.adaptris.core.Adapter)3 Test (org.junit.Test)3 HashSet (java.util.HashSet)2 CoreException (com.adaptris.core.CoreException)1 TimeoutException (java.util.concurrent.TimeoutException)1