Package org.springframework.transaction

Examples of org.springframework.transaction.PlatformTransactionManager


            container.setRecoveryInterval(recoveryInterval);
        }
        if (taskExecutor != null) {
            container.setTaskExecutor(taskExecutor);
        }
        PlatformTransactionManager tm = getTransactionManager();
        if (tm != null && transacted) {
            container.setTransactionManager(tm);
        } else if (transacted) {
            throw new IllegalArgumentException("Property transacted is enabled but a transactionManager was not injected!");
        }
View Full Code Here


    }

    protected CamelContext createCamelContext() throws Exception {
        spring = new ClassPathXmlApplicationContext("org/apache/camel/component/jms/spring.xml");
        SpringCamelContext ctx = SpringCamelContext.springCamelContext(spring);
        PlatformTransactionManager transactionManager = (PlatformTransactionManager)spring.getBean("jmsTransactionManager");
        ConnectionFactory connectionFactory = (ConnectionFactory)spring.getBean("jmsConnectionFactory");
        JmsComponent component = JmsComponent.jmsComponentTransacted(connectionFactory, transactionManager);
        component.getConfiguration().setConcurrentConsumers(1);
        ctx.addComponent("activemq", component);
        return ctx;
View Full Code Here

            incomingObserver.onMessage(inMessage);
           
            //need to propagate any exceptions back to Spring container
            //so transactions can occur
            if (inMessage.getContent(Exception.class) != null && session != null) {
                PlatformTransactionManager m = jmsConfig.getTransactionManager();
                if (m != null) {
                    TransactionStatus status = m.getTransaction(null);
                    JmsResourceHolder resourceHolder =
                        (JmsResourceHolder) TransactionSynchronizationManager
                            .getResource(jmsConfig.getConnectionFactory());
                    boolean trans = resourceHolder == null
                        || !resourceHolder.containsSession(session);
View Full Code Here

                inMessage = inMessage.getExchange().getInMessage();
            }
            //need to propagate any exceptions back to Spring container
            //so transactions can occur
            if (inMessage.getContent(Exception.class) != null && session != null) {
                PlatformTransactionManager m = jmsConfig.getTransactionManager();
                if (m != null) {
                    TransactionStatus status = m.getTransaction(null);
                    JmsResourceHolder resourceHolder =
                        (JmsResourceHolder) TransactionSynchronizationManager
                            .getResource(jmsConfig.getConnectionFactory());
                    boolean trans = resourceHolder == null
                        || !resourceHolder.containsSession(session);
View Full Code Here

  private static Map3 getFactoryBeanMap3(final SpringContext ctxt,
      final String[] itfs){
    return new Map3(){
      public Object map(Object tx, Object attrs, Object obj)
      throws Exception{
        final PlatformTransactionManager man =(PlatformTransactionManager)tx;
        final Properties tattrs = (Properties)attrs;
        final Object r = injectFactoryBeanResult(ctxt, obj);
        return proxyTransaction(r, ctxt, man, tattrs, itfs);
      }
    };
View Full Code Here

            container.setRecoveryInterval(recoveryInterval);
        }
        if (taskExecutor != null) {
            container.setTaskExecutor(taskExecutor);
        }
        PlatformTransactionManager tm = getTransactionManager();
        if (tm != null) {
            container.setTransactionManager(tm);
        } else if (transactionManager == null && transacted && !lazyCreateTransactionManager) {
            container.setSessionTransacted(true);
        }
View Full Code Here

                listenerContainer.setRecoveryInterval(recoveryInterval);
            }
            if (taskExecutor != null) {
                listenerContainer.setTaskExecutor(taskExecutor);
            }
            PlatformTransactionManager tm = getTransactionManager();
            if (tm != null && transacted) {
                listenerContainer.setTransactionManager(tm);
            } else if (transacted) {
                throw new IllegalArgumentException("Property transacted is enabled but a transactionManager was not injected!");
            }
View Full Code Here

    }

    protected CamelContext createCamelContext() throws Exception {
        spring = new ClassPathXmlApplicationContext("org/apache/camel/component/jms/spring.xml");
        SpringCamelContext ctx = SpringCamelContext.springCamelContext(spring);
        PlatformTransactionManager transactionManager = (PlatformTransactionManager)spring.getBean("jmsTransactionManager");
        ConnectionFactory connectionFactory = (ConnectionFactory)spring.getBean("jmsConnectionFactory");
        JmsComponent component = JmsComponent.jmsComponentTransacted(connectionFactory, transactionManager);
        component.getConfiguration().setConcurrentConsumers(1);
        ctx.addComponent("activemq", component);
        return ctx;
View Full Code Here

          properties.getUrl(),
          properties.getUsername(),
          properties.getPassword(),
          true);
     
      PlatformTransactionManager txnMgr = new DataSourceTransactionManager(ds);
      DBConnectionManager conn = new DBConnectionManager(dataSourceName, ds, txnMgr, null, false);
      return conn;
    }
View Full Code Here

            // There is no guaranteed way of determining whether a transaction is active or not
            // under spring. So we try to join the existing one, and if we can't, it's not active
            // (We could inspect the transaction data stack for the thread, but this isn't guaranteed
            // if the user has created transactions for themselves)
            try {
                PlatformTransactionManager qq_txn1 = pDataSource.getTransactionManager();
                TransactionStatus aTxnStatus = qq_txn1.getTransaction(new DefaultTransactionDefinition(TransactionDefinition.PROPAGATION_MANDATORY));
                qq_txn1.commit(aTxnStatus);
                return true;
            }
            catch (Exception e) {
                return false;
            }
View Full Code Here

TOP

Related Classes of org.springframework.transaction.PlatformTransactionManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.