Package org.springframework.transaction.jta

Examples of org.springframework.transaction.jta.JtaTransactionManager


            if (tm == null) {
                throw new IllegalStateException("No TransactionManager available");
            } else if (tm instanceof PlatformTransactionManager) {
                cont.setTransactionManager((PlatformTransactionManager) tm);
            } else {
                cont.setTransactionManager(new JtaTransactionManager(tm));
            }
        } else if (TRANSACTED_JMS.equals(transacted)) {
            cont.setSessionTransacted(true);
            if (isJms102()) {
                cont.setTransactionManager(new JmsTransactionManager102(getConnectionFactory(), isPubSubDomain()));
View Full Code Here


    SimpleNamingContextBuilder jndi = SimpleNamingContextBuilder
        .emptyActivatedContextBuilder();
    DataSource ds = new DriverManagerDataSource();
    jndi.bind("java:comp/env/jdbc/RecordShopDS", ds);

    JtaTransactionManager jtam = new JtaTransactionManager();
    jtam.setUserTransaction(EasyMock.createMock(UserTransaction.class));
    jndi.bind(JtaTransactionManager.DEFAULT_USER_TRANSACTION_NAME, jtam
        .getUserTransaction());
  }
View Full Code Here

    private final PlatformTransactionManager platformTransactionManager;
    private final Map<Transaction, SuspendedResourcesHolder> suspendedResources = new ConcurrentHashMap<Transaction, SuspendedResourcesHolder>();

    public GeronimoPlatformTransactionManager() throws XAException {
        platformTransactionManager = new JtaTransactionManager(this, this);
        registerTransactionAssociationListener();
    }
View Full Code Here

        registerTransactionAssociationListener();
    }

    public GeronimoPlatformTransactionManager(int defaultTransactionTimeoutSeconds) throws XAException {
        super(defaultTransactionTimeoutSeconds);
        platformTransactionManager = new JtaTransactionManager(this, this);
        registerTransactionAssociationListener();
    }
View Full Code Here

        registerTransactionAssociationListener();
    }

    public GeronimoPlatformTransactionManager(int defaultTransactionTimeoutSeconds, TransactionLog transactionLog) throws XAException {
        super(defaultTransactionTimeoutSeconds, transactionLog);
        platformTransactionManager = new JtaTransactionManager(this, this);
        registerTransactionAssociationListener();
    }
View Full Code Here

        registerTransactionAssociationListener();
    }

    public GeronimoPlatformTransactionManager(int defaultTransactionTimeoutSeconds, XidFactory xidFactory, TransactionLog transactionLog) throws XAException {
        super(defaultTransactionTimeoutSeconds, xidFactory, transactionLog);
        platformTransactionManager = new JtaTransactionManager(this, this);
        registerTransactionAssociationListener();
    }
View Full Code Here

     * Factory method that creates a {@link PlatformTransactionManager}.
     *
     * @return {@link PlatformTransactionManager} the created PlatformTransactionManager.
     */
    public PlatformTransactionManager create() {
        JtaTransactionManager transactionManager;

        if (isBound(JBOSS_USER_TRANSACTION)) {
            transactionManager = new JtaTransactionManager();
            transactionManager.setUserTransactionName(JBOSS_USER_TRANSACTION);
            transactionManager.setTransactionManagerName(JBOSS_TRANSACTION_MANANGER);
            transactionManager.setTransactionSynchronizationRegistryName(JBOSS_TRANSACTION_SYNC_REG);
        } else if (isBound(OSGI_TRANSACTION_MANAGER)) {
            transactionManager = new JtaTransactionManager((TransactionManager)lookupInJndi(OSGI_TRANSACTION_MANAGER));
        } else if (isBound(JtaTransactionManager.DEFAULT_USER_TRANSACTION_NAME)) {
            transactionManager = new JtaTransactionManager();
            transactionManager.setUserTransactionName(JtaTransactionManager.DEFAULT_USER_TRANSACTION_NAME);
        } else {
            throw CommonCamelMessages.MESSAGES.couldNotCreateAJtaTransactionManagerAsNoTransactionManagerWasFoundJBOSSUSERTRANSACTION(
                    JBOSS_USER_TRANSACTION,
                    OSGI_TRANSACTION_MANAGER,
                    JtaTransactionManager.DEFAULT_USER_TRANSACTION_NAME);
        }

        // Initialize the transaction manager.
        transactionManager.afterPropertiesSet();
        return transactionManager;
    }
View Full Code Here

        KieSession ksession = engine.getKieSession();
        TaskService taskService = engine.getTaskService();

        Map<String, Object> parameters = new HashMap<String, Object>();
        parameters.put("owner", "john");
        JtaTransactionManager jtaTxm = (JtaTransactionManager) context.getBean("jbpmTxManager");
        TransactionStatus ut = null;

        try {
            ut = beginTransaction(jtaTxm);

            ProcessInstance processInstance = ksession.startProcess("expense", parameters);

            executeTasksByProcessByTaskName(processInstance.getId(), "create", taskService);

            jtaTxm.commit(ut);
            ut = beginTransaction(jtaTxm);

            executeTasksByProcessByTaskName(processInstance.getId(), "edit", taskService);

            jtaTxm.commit(ut);
            ut = beginTransaction(jtaTxm);

            //The problem happens here. There is no task "edit", but it should be.
            executeTasksByProcessByTaskName(processInstance.getId(), "edit", taskService);

            jtaTxm.commit(ut);
            ut = beginTransaction(jtaTxm);

            executeTasksByProcessByTaskName(processInstance.getId(), "edit", taskService);

            jtaTxm.commit(ut);
            ut = beginTransaction(jtaTxm);

            executeTasksByProcessByTaskName(processInstance.getId(), "delete", taskService);

            jtaTxm.commit(ut);
        } finally {
//            if (ut != null && javax.transaction.Status.STATUS_ACTIVE == ut.getStatus()) {
//                jtaTxm.rollback(ut);
//            }
        }
View Full Code Here

        userTransactionManager.init();

        UserTransactionImp userTransactionImp = new UserTransactionImp();
        userTransactionImp.setTransactionTimeout(300);

        JtaTransactionManager jtaTransactionManager = new JtaTransactionManager();
        jtaTransactionManager.setTransactionManager(userTransactionManager);
        jtaTransactionManager.setUserTransaction(userTransactionImp);

        registry.put("jta.transactionManager", jtaTransactionManager);

        SpringTransactionPolicy propagationRequired = new SpringTransactionPolicy();
        propagationRequired.setTransactionManager(jtaTransactionManager);
View Full Code Here

    return dataSourceLookup.getDataSource("java:jboss/datasources/springdemo");
  }

  @Bean
  public JtaTransactionManager transactionManager() {
    return new JtaTransactionManager();
  }
View Full Code Here

TOP

Related Classes of org.springframework.transaction.jta.JtaTransactionManager

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.