Search in sources :

Example 61 with CoreException

use of com.adaptris.core.CoreException in project interlok by adaptris.

the class JmsConnectionErrorHandler method init.

@Override
public void init() throws CoreException {
    super.init();
    try {
        retrieveConnection(JmsConnection.class).currentConnection().setExceptionListener(this);
        inOnException.set(false);
    } catch (JMSException e) {
        throw new CoreException(e);
    }
}
Also used : CoreException(com.adaptris.core.CoreException) JMSException(javax.jms.JMSException)

Example 62 with CoreException

use of com.adaptris.core.CoreException in project interlok by adaptris.

the class JmsConsumerImpl method start.

@Override
public void start() throws CoreException {
    try {
        consumer = createConsumer();
        consumer.setMessageListener(this);
    } catch (JMSException e) {
        throw new CoreException(e);
    }
    LifecycleHelper.start(messageTranslator);
}
Also used : CoreException(com.adaptris.core.CoreException) JMSException(javax.jms.JMSException)

Example 63 with CoreException

use of com.adaptris.core.CoreException in project interlok by adaptris.

the class FailoverJmsConnection method initConnection.

/**
 * @see com.adaptris.core.AdaptrisConnectionImp#init()
 */
@Override
protected void initConnection() throws CoreException {
    boolean connected = false;
    int attempts = 0;
    while (!connected) {
        attempts++;
        for (JmsConnection con : connections) {
            current = nullifyRetry(con);
            try {
                current.setConnectionAttempts(1);
                registerExceptionListeners(current);
                LifecycleHelper.init(current);
                super.connection = current.connection;
                connected = true;
                break;
            } catch (CoreException e) {
            // Nothing to do
            }
        }
        if (connected == false) {
            log.warn("Failed in all attempts to connect to brokers");
            if (attempts > connectionAttempts() && connectionAttempts() > -1) {
                throw new CoreException("Failed in all attempts to connect to brokers");
            } else {
                try {
                    log.info("Failed to connect to all listed brokers, waiting for retry");
                    Thread.sleep(connectionRetryInterval());
                } catch (InterruptedException e2) {
                    throw new CoreException("Received interrupt before (re)connecting to brokers", e2);
                }
            }
        }
    }
}
Also used : CoreException(com.adaptris.core.CoreException)

Example 64 with CoreException

use of com.adaptris.core.CoreException in project interlok by adaptris.

the class ChannelManager method initMembers.

private void initMembers() throws MalformedObjectNameException, CoreException {
    if (isEmpty(channel.getUniqueId())) {
        throw new CoreException("No UniqueID, this channel cannot be managed");
    }
    // Builds up a name com.adaptris:type=Channel, adapter=<adapter-id,>, id=<channel-id>
    myObjectName = ObjectName.getInstance(JMX_CHANNEL_TYPE + ADAPTER_PREFIX + parent.getUniqueId() + ID_PREFIX + getWrappedComponent().getUniqueId());
    for (Workflow c : channel.getWorkflowList()) {
        if (!isEmpty(c.getUniqueId())) {
            addChild(new WorkflowManager(c, this, true), true);
        }
    }
    addChildJmxComponentQuietly((ChildRuntimeInfoComponent) RuntimeInfoComponentFactory.create(this, channel.getMessageErrorHandler()));
    marshalConfig();
}
Also used : CoreException(com.adaptris.core.CoreException) Workflow(com.adaptris.core.Workflow)

Example 65 with CoreException

use of com.adaptris.core.CoreException in project interlok by adaptris.

the class ChildRuntimeInfoComponentImpl method registerMBean.

@Override
public void registerMBean() throws CoreException {
    try {
        ObjectName objName = createObjectName();
        log.trace("Registering {} against {}", this.getClass().getName(), objName);
        JmxHelper.register(objName, this);
    } catch (Exception e) {
        throw new CoreException(e);
    }
}
Also used : CoreException(com.adaptris.core.CoreException) MalformedObjectNameException(javax.management.MalformedObjectNameException) CoreException(com.adaptris.core.CoreException) ObjectName(javax.management.ObjectName)

Aggregations

CoreException (com.adaptris.core.CoreException)186 Test (org.junit.Test)110 AdaptrisMessage (com.adaptris.core.AdaptrisMessage)44 Adapter (com.adaptris.core.Adapter)32 ObjectName (javax.management.ObjectName)29 Channel (com.adaptris.core.Channel)27 ArrayList (java.util.ArrayList)24 IOException (java.io.IOException)20 File (java.io.File)19 ServiceException (com.adaptris.core.ServiceException)14 TimeInterval (com.adaptris.util.TimeInterval)13 Document (org.w3c.dom.Document)12 MalformedObjectNameException (javax.management.MalformedObjectNameException)11 AdaptrisMarshaller (com.adaptris.core.AdaptrisMarshaller)10 StandardWorkflow (com.adaptris.core.StandardWorkflow)9 URLString (com.adaptris.util.URLString)9 TimeoutException (java.util.concurrent.TimeoutException)9 PoolingWorkflow (com.adaptris.core.PoolingWorkflow)8 Workflow (com.adaptris.core.Workflow)8 XPath (com.adaptris.util.text.xml.XPath)8