Search in sources :

Example 21 with ResourceException

use of javax.resource.ResourceException in project tomee by apache.

the class ActiveMQResourceAdapter method endpointActivation.

@Override
public void endpointActivation(final MessageEndpointFactory endpointFactory, final ActivationSpec activationSpec) throws ResourceException {
    final BeanContext current = MdbContainer.current();
    if (current != null && "false".equalsIgnoreCase(current.getProperties().getProperty("MdbActiveOnStartup"))) {
        if (!equals(activationSpec.getResourceAdapter())) {
            throw new ResourceException("Activation spec not initialized with this ResourceAdapter instance (" + activationSpec.getResourceAdapter() + " != " + this + ")");
        }
        if (!(activationSpec instanceof MessageActivationSpec)) {
            throw new NotSupportedException("That type of ActivationSpec not supported: " + activationSpec.getClass());
        }
        final ActiveMQEndpointActivationKey key = new ActiveMQEndpointActivationKey(endpointFactory, MessageActivationSpec.class.cast(activationSpec));
        Map.class.cast(Reflections.get(this, "endpointWorkers")).put(key, new ActiveMQEndpointWorker(this, key) {
        });
    // we dont want that worker.start();
    } else {
        super.endpointActivation(endpointFactory, activationSpec);
    }
    if (current != null) {
        addJMxControl(current, current.getProperties().getProperty("MdbJMXControl"));
    }
}
Also used : ActiveMQEndpointWorker(org.apache.activemq.ra.ActiveMQEndpointWorker) BeanContext(org.apache.openejb.BeanContext) ResourceException(javax.resource.ResourceException) MessageActivationSpec(org.apache.activemq.ra.MessageActivationSpec) NotSupportedException(javax.resource.NotSupportedException) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) ActiveMQEndpointActivationKey(org.apache.activemq.ra.ActiveMQEndpointActivationKey)

Aggregations

ResourceException (javax.resource.ResourceException)21 Connection (javax.resource.cci.Connection)4 LocalTransactionException (javax.resource.spi.LocalTransactionException)4 SystemException (javax.transaction.SystemException)4 ManagedConnection (javax.resource.spi.ManagedConnection)3 MessageEndpoint (javax.resource.spi.endpoint.MessageEndpoint)3 LogWriter (org.apache.geode.LogWriter)3 TXStateProxy (org.apache.geode.internal.cache.TXStateProxy)3 IOException (java.io.IOException)2 RepositoryException (javax.jcr.RepositoryException)2 NotSupportedException (javax.resource.NotSupportedException)2 ActivationSpec (javax.resource.spi.ActivationSpec)2 RollbackException (javax.transaction.RollbackException)2 Transaction (javax.transaction.Transaction)2 XAResource (javax.transaction.xa.XAResource)2 TransactionSystemException (org.springframework.transaction.TransactionSystemException)2 IntrospectionException (java.beans.IntrospectionException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Method (java.lang.reflect.Method)1 SQLException (java.sql.SQLException)1