javax.resource.spi.ActivationSpec Java Examples
The following examples show how to use
javax.resource.spi.ActivationSpec.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GenericMessageEndpointManager.java From spring4-understanding with Apache License 2.0 | 6 votes |
/** * Prepares the message endpoint, and automatically activates it * if the "autoStartup" flag is set to "true". */ @Override public void afterPropertiesSet() throws ResourceException { if (getResourceAdapter() == null) { throw new IllegalArgumentException("Property 'resourceAdapter' is required"); } if (getMessageEndpointFactory() == null) { throw new IllegalArgumentException("Property 'messageEndpointFactory' is required"); } ActivationSpec activationSpec = getActivationSpec(); if (activationSpec == null) { throw new IllegalArgumentException("Property 'activationSpec' is required"); } if (activationSpec.getResourceAdapter() == null) { activationSpec.setResourceAdapter(getResourceAdapter()); } else if (activationSpec.getResourceAdapter() != getResourceAdapter()) { throw new IllegalArgumentException("ActivationSpec [" + activationSpec + "] is associated with a different ResourceAdapter: " + activationSpec.getResourceAdapter()); } }
Example #2
Source File: GenericMessageEndpointManager.java From spring-analysis-note with MIT License | 6 votes |
/** * Prepares the message endpoint, and automatically activates it * if the "autoStartup" flag is set to "true". */ @Override public void afterPropertiesSet() throws ResourceException { if (getResourceAdapter() == null) { throw new IllegalArgumentException("Property 'resourceAdapter' is required"); } if (getMessageEndpointFactory() == null) { throw new IllegalArgumentException("Property 'messageEndpointFactory' is required"); } ActivationSpec activationSpec = getActivationSpec(); if (activationSpec == null) { throw new IllegalArgumentException("Property 'activationSpec' is required"); } if (activationSpec.getResourceAdapter() == null) { activationSpec.setResourceAdapter(getResourceAdapter()); } else if (activationSpec.getResourceAdapter() != getResourceAdapter()) { throw new IllegalArgumentException("ActivationSpec [" + activationSpec + "] is associated with a different ResourceAdapter: " + activationSpec.getResourceAdapter()); } }
Example #3
Source File: ActiveMQResourceAdapter.java From activemq-artemis with Apache License 2.0 | 6 votes |
/** * Get XA resources * * @param specs The activation specs * @return The XA resources * @throws ResourceException Thrown if an error occurs or unsupported */ @Override public XAResource[] getXAResources(final ActivationSpec[] specs) throws ResourceException { if (logger.isTraceEnabled()) { logger.trace("getXAResources(" + Arrays.toString(specs) + ")"); } if (useAutoRecovery) { // let the TM handle the recovery return null; } else { List<XAResource> xaresources = new ArrayList<>(); for (ActivationSpec spec : specs) { ActiveMQActivation activation = activations.get(spec); if (activation != null) { xaresources.addAll(activation.getXAResources()); } } return xaresources.toArray(new XAResource[xaresources.size()]); } }
Example #4
Source File: ActiveMQResourceAdapter.java From activemq-artemis with Apache License 2.0 | 6 votes |
/** * Endpoint activation * * @param endpointFactory The endpoint factory * @param spec The activation spec * @throws ResourceException Thrown if an error occurs */ @Override public void endpointActivation(final MessageEndpointFactory endpointFactory, final ActivationSpec spec) throws ResourceException { if (spec == null) { throw ActiveMQRABundle.BUNDLE.noActivationSpec(); } if (!configured.getAndSet(true)) { try { setup(); } catch (ActiveMQException e) { throw new ResourceException("Unable to create activation", e); } } if (logger.isTraceEnabled()) { logger.trace("endpointActivation(" + endpointFactory + ", " + spec + ")"); } ActiveMQActivation activation = new ActiveMQActivation(this, endpointFactory, (ActiveMQActivationSpec) spec); activations.put(spec, activation); activation.start(); }
Example #5
Source File: XAResourceRecoveryImpl.java From ironjacamar with Eclipse Public License 1.0 | 6 votes |
/** * {@inheritDoc} */ @Override public void initialize() throws Exception { if (rar != null) { for (XAResource xar : rar.getXAResources(new ActivationSpec[] {as})) { // Trigger a recovery pass xar.recover(XAResource.TMSTARTRSCAN); xar.recover(XAResource.TMENDRSCAN); } } else { // Create ManagedConnection mc = mcf.createManagedConnection(subjectFactory.createSubject(securityDomain), null); // Trigger a recovery pass mc.getXAResource().recover(XAResource.TMSTARTRSCAN); mc.getXAResource().recover(XAResource.TMENDRSCAN); } }
Example #6
Source File: XAResourceRecoveryInflowImpl.java From lams with GNU General Public License v2.0 | 6 votes |
/** * Constructor * * @param rar The resource adapter * @param as The activation spec * @param productName The product name * @param productVersion The product version */ public XAResourceRecoveryInflowImpl(ResourceAdapter rar, ActivationSpec as, String productName, String productVersion) { if (rar == null) throw new IllegalArgumentException("ResourceAdapter is null"); if (as == null) throw new IllegalArgumentException("ActivationSpec is null"); this.resourceAdapter = rar; this.activationSpec = as; this.productName = productName; this.productVersion = productVersion; this.jndiName = null; }
Example #7
Source File: ResourceAdapterImpl.java From cxf with Apache License 2.0 | 6 votes |
public void endpointDeactivation(MessageEndpointFactory mef, ActivationSpec as) { if (!(as instanceof MDBActivationSpec)) { LOG.fine("Ignored unknown activation spec " + as); return; } MDBActivationSpec spec = (MDBActivationSpec)as; LOG.info("CXF resource adapter is deactivating " + spec.getDisplayName()); InboundEndpoint endpoint = endpoints.remove(spec.getDisplayName()); if (endpoint != null) { try { endpoint.shutdown(); } catch (Exception e) { LOG.log(Level.WARNING, "Failed to stop endpoint " + spec.getDisplayName(), e); } } }
Example #8
Source File: ResourceAdapterImpl.java From ironjacamar with Eclipse Public License 1.0 | 5 votes |
/** * {@inheritDoc} */ public void endpointActivation(MessageEndpointFactory mef, ActivationSpec as) throws Exception { if (mef == null) throw new Exception("MessageEndpointFactory is null"); if (as == null) throw new Exception("ActivationSpec is null"); as.setResourceAdapter(resourceAdapter); try { as.validate(); } catch (UnsupportedOperationException uoe) { // Ignore } if (is16) { verifyBeanValidation(as); } resourceAdapter.endpointActivation(mef, as); InflowRecovery ir = null; if (transactionIntegration != null && transactionIntegration.getRecoveryRegistry() != null) { XAResourceRecovery xar = transactionIntegration.createXAResourceRecovery(resourceAdapter, as, productName, productVersion); ir = new InflowRecoveryImpl(mef, as, xar, transactionIntegration.getRecoveryRegistry()); ir.activate(); } activeEndpoints.put(new Endpoint(mef, as), ir); }
Example #9
Source File: MdbPoolContainer.java From tomee with Apache License 2.0 | 5 votes |
public MdbActivationContext(final ClassLoader classLoader, final BeanContext beanContext, final ResourceAdapter resourceAdapter, final EndpointFactory endpointFactory, final ActivationSpec activationSpec) { this.classLoader = classLoader; this.beanContext = beanContext; this.resourceAdapter = resourceAdapter; this.endpointFactory = endpointFactory; this.activationSpec = activationSpec; }
Example #10
Source File: SampleResourceAdapter.java From tomee with Apache License 2.0 | 5 votes |
public void endpointActivation(final MessageEndpointFactory messageEndpointFactory, final ActivationSpec activationSpec) throws ResourceException { final SampleActivationSpec sampleActivationSpec = (SampleActivationSpec) activationSpec; try { targets.put(sampleActivationSpec, messageEndpointFactory); } catch (Exception e) { e.printStackTrace(); } }
Example #11
Source File: TransactionIntegrationImpl.java From ironjacamar with Eclipse Public License 1.0 | 5 votes |
/** * {@inheritDoc} */ public XAResourceRecovery createXAResourceRecovery(ResourceAdapter rar, ActivationSpec as, String productName, String productVersion) { return new XAResourceRecoveryInflowImpl(rar, as, productName, productVersion); }
Example #12
Source File: ResourceAdapterImpl.java From cxf with Apache License 2.0 | 5 votes |
public void endpointActivation(MessageEndpointFactory mef, ActivationSpec as) throws ResourceException { if (!(as instanceof MDBActivationSpec)) { LOG.fine("Ignored unknown activation spec " + as); return; } MDBActivationSpec spec = (MDBActivationSpec)as; LOG.info("CXF resource adapter is activating " + spec.getDisplayName()); Work work = new MDBActivationWork(spec, mef, endpoints); ctx.getWorkManager().scheduleWork(work); }
Example #13
Source File: JcaExecutorServiceConnector.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public void endpointDeactivation(MessageEndpointFactory endpointFactory, ActivationSpec spec) { try { if(jobHandlerActivation != null) { jobHandlerActivation.stop(); } } finally { jobHandlerActivation = null; } }
Example #14
Source File: ActiveMQResourceAdapter.java From activemq-artemis with Apache License 2.0 | 5 votes |
/** * Stop */ @Override public void stop() { if (logger.isTraceEnabled()) { logger.trace("stop()"); } for (Map.Entry<ActivationSpec, ActiveMQActivation> entry : activations.entrySet()) { try { entry.getValue().stop(); } catch (Exception ignored) { ActiveMQRALogger.LOGGER.debug("Ignored", ignored); } } activations.clear(); for (ActiveMQRAManagedConnectionFactory managedConnectionFactory : managedConnectionFactories) { managedConnectionFactory.stop(); } managedConnectionFactories.clear(); for (Pair<ActiveMQConnectionFactory, AtomicInteger> pair : knownConnectionFactories.values()) { pair.getA().close(); } knownConnectionFactories.clear(); if (defaultActiveMQConnectionFactory != null) { defaultActiveMQConnectionFactory.close(); } if (recoveryActiveMQConnectionFactory != null) { recoveryActiveMQConnectionFactory.close(); } recoveryManager.stop(); ActiveMQRALogger.LOGGER.raStopped(); }
Example #15
Source File: SpringContextResourceAdapter.java From spring-analysis-note with MIT License | 5 votes |
/** * This implementation always throws a NotSupportedException. */ @Override public void endpointActivation(MessageEndpointFactory messageEndpointFactory, ActivationSpec activationSpec) throws ResourceException { throw new NotSupportedException("SpringContextResourceAdapter does not support message endpoints"); }
Example #16
Source File: NoMessageDeliveryTest.java From tomee with Apache License 2.0 | 5 votes |
public void endpointDeactivation(final MessageEndpointFactory messageEndpointFactory, final ActivationSpec activationSpec) { final EmailAccountInfo accountInfo = (EmailAccountInfo) activationSpec; final EmailConsumer emailConsumer = consumers.remove(accountInfo.getAddress()); final MessageEndpoint endpoint = (MessageEndpoint) emailConsumer; endpoint.release(); }
Example #17
Source File: GenericResourceAdapter.java From genericconnector with Apache License 2.0 | 4 votes |
@Override public void endpointDeactivation(MessageEndpointFactory endpointFactory, ActivationSpec spec) { log.log(Level.INFO, "deactivating endpoint"); }
Example #18
Source File: ResourceAdapterImpl.java From ironjacamar with Eclipse Public License 1.0 | 4 votes |
/** * Constructor * @param mef The MessageEndpointFactory * @param as The ActivationSpec */ Endpoint(MessageEndpointFactory mef, ActivationSpec as) { this.mef = mef; this.as = as; }
Example #19
Source File: ActiveMQRATestBase.java From activemq-artemis with Apache License 2.0 | 4 votes |
protected ActiveMQActivation lookupActivation(ActiveMQResourceAdapter qResourceAdapter) { Map<ActivationSpec, ActiveMQActivation> activations = qResourceAdapter.getActivations(); assertEquals(1, activations.size()); return activations.values().iterator().next(); }
Example #20
Source File: JcaExecutorServiceConnector.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
public XAResource[] getXAResources(ActivationSpec[] specs) throws ResourceException { log.finest("getXAResources()"); return null; }
Example #21
Source File: ConnectorProxyTest.java From tomee with Apache License 2.0 | 4 votes |
@Override public void endpointActivation(final MessageEndpointFactory endpointFactory, final ActivationSpec spec) throws ResourceException { // no-op }
Example #22
Source File: StubResourceAdapter.java From spring4-understanding with Apache License 2.0 | 4 votes |
@Override public void endpointActivation(MessageEndpointFactory messageEndpointFactory, ActivationSpec activationSpec) throws ResourceException { }
Example #23
Source File: CustomMdbContainerTest.java From tomee with Apache License 2.0 | 4 votes |
public XAResource[] getXAResources(final ActivationSpec[] activationSpecs) throws ResourceException { return new XAResource[0]; }
Example #24
Source File: ResourceAdapterImpl.java From ByteJTA with GNU Lesser General Public License v3.0 | 4 votes |
public void endpointDeactivation(MessageEndpointFactory endpointFactory, ActivationSpec spec) { }
Example #25
Source File: SpringContextResourceAdapter.java From spring4-understanding with Apache License 2.0 | 4 votes |
/** * This implementation always returns {@code null}. */ @Override public XAResource[] getXAResources(ActivationSpec[] activationSpecs) throws ResourceException { return null; }
Example #26
Source File: FakeResourceAdapter.java From wildfly-camel with Apache License 2.0 | 4 votes |
@Override public XAResource[] getXAResources(ActivationSpec[] activationSpecs) throws ResourceException { return null; }
Example #27
Source File: ConnectorProxyTest.java From tomee with Apache License 2.0 | 4 votes |
@Override public XAResource[] getXAResources(final ActivationSpec[] specs) throws ResourceException { return new XAResource[0]; }
Example #28
Source File: MessageListenerImpl.java From ironjacamar with Eclipse Public License 1.0 | 4 votes |
/** * {@inheritDoc} */ public ActivationSpec createActivationSpec() throws Exception { return activationSpecClass.newInstance(); }
Example #29
Source File: XAResourceRecoveryImpl.java From ironjacamar with Eclipse Public License 1.0 | 4 votes |
/** * Constructor * @param rar The resource adapter * @param as The activation spec */ public XAResourceRecoveryImpl(ResourceAdapter rar, ActivationSpec as) { this.rar = rar; this.as = as; }
Example #30
Source File: GetterConnectorTest.java From tomee with Apache License 2.0 | 4 votes |
@Override public void endpointDeactivation(final MessageEndpointFactory endpointFactory, final ActivationSpec spec) { // no-op }