Search in sources :

Example 6 with NotSupportedException

use of javax.resource.NotSupportedException 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

NotSupportedException (javax.resource.NotSupportedException)6 ResourceException (javax.resource.ResourceException)3 Connection (javax.resource.cci.Connection)3 SQLException (java.sql.SQLException)2 Map (java.util.Map)1 Callable (java.util.concurrent.Callable)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 ExecutionException (java.util.concurrent.ExecutionException)1 ConnectionFactory (javax.resource.cci.ConnectionFactory)1 IndexedRecord (javax.resource.cci.IndexedRecord)1 Interaction (javax.resource.cci.Interaction)1 InteractionSpec (javax.resource.cci.InteractionSpec)1 MappedRecord (javax.resource.cci.MappedRecord)1 Record (javax.resource.cci.Record)1 RecordFactory (javax.resource.cci.RecordFactory)1 LocalTransactionException (javax.resource.spi.LocalTransactionException)1 WorkException (javax.resource.spi.work.WorkException)1 XAConnection (javax.sql.XAConnection)1 SystemException (javax.transaction.SystemException)1 Transaction (javax.transaction.Transaction)1