Examples of UnspecifiedTransactionContext


Examples of org.apache.geronimo.transaction.UnspecifiedTransactionContext

        this.unshareableResources = unshareableResources;
    }

    public Object invoke(InstanceContext newInstanceContext) throws Throwable {
        if (TransactionContext.getContext() == null) {
            TransactionContext.setContext(new UnspecifiedTransactionContext());
        }
        TrackedConnectionAssociator.ConnectorContextInfo oldConnectorContext = cachedConnectionAssociator.enter(newInstanceContext, unshareableResources);
        try {
            return next.invoke(newInstanceContext);
        } finally {
View Full Code Here

Examples of org.apache.geronimo.transaction.UnspecifiedTransactionContext

        assertTrue("Expected TransactionContext to report inactive", !transactionContext.isActive());

    }

    public void testGetConnectionOutsideTransaction() throws Exception {
        TransactionContext.setContext(new UnspecifiedTransactionContext());
        ConnectionInfo connectionInfo1 = makeConnectionInfo();
        transactionCachingInterceptor.getConnection(connectionInfo1);
        assertTrue("Expected to get an initial connection", obtainedConnectionInfo != null);
        assertTrue("Expected nothing returned yet", returnedConnectionInfo == null);
        assertTrue("Expected no ManagedConnectionInfo in the TransactionContext",
View Full Code Here

Examples of org.apache.geronimo.transaction.UnspecifiedTransactionContext

            // Turn on the UserTransaction
            userTransaction.setOnline(true);

            if (TransactionContext.getContext() == null) {
                TransactionContext.setContext(new UnspecifiedTransactionContext());
            }
            try {
                oldConnectorContext = associator.enter(new DefaultComponentContext(), unshareableResources);
            } catch (ResourceException e) {
                throw new RuntimeException(e);
View Full Code Here

Examples of org.apache.geronimo.transaction.UnspecifiedTransactionContext

        public void begin() throws NotSupportedException, SystemException {
            TransactionContext ctx = TransactionContext.getContext();
            if (ctx instanceof UnspecifiedTransactionContext == false) {
                throw new NotSupportedException("Previous Transaction has not been committed");
            }
            UnspecifiedTransactionContext oldContext = (UnspecifiedTransactionContext) ctx;
            BeanTransactionContext newContext = new BeanTransactionContext(txnManager, oldContext);
            oldContext.suspend();
            try {
                newContext.begin();
            } catch (SystemException e) {
                oldContext.resume();
                throw e;
            } catch (NotSupportedException e) {
                oldContext.resume();
                throw e;
            }
            TransactionContext.setContext(newContext);

            if(trackedConnectionAssociator != null) {
View Full Code Here

Examples of org.apache.geronimo.transaction.UnspecifiedTransactionContext

            }
            BeanTransactionContext beanContext = (BeanTransactionContext) ctx;
            try {
                beanContext.commit();
            } finally {
                UnspecifiedTransactionContext oldContext = beanContext.getOldContext();
                TransactionContext.setContext(oldContext);
                oldContext.resume();
            }
        }
View Full Code Here

Examples of org.apache.geronimo.transaction.UnspecifiedTransactionContext

            }
            BeanTransactionContext beanContext = (BeanTransactionContext) ctx;
            try {
                beanContext.rollback();
            } finally {
                UnspecifiedTransactionContext oldContext = beanContext.getOldContext();
                TransactionContext.setContext(oldContext);
                oldContext.resume();
            }
        }
View Full Code Here

Examples of org.apache.geronimo.transaction.UnspecifiedTransactionContext

        committed = false;
    }

    public void testNoTransaction() throws Exception {
        ConnectionInfo connectionInfo = makeConnectionInfo();
        TransactionContext.setContext(new UnspecifiedTransactionContext());
        transactionEnlistingInterceptor.getConnection(connectionInfo);
        assertTrue("Expected not started", !started);
        assertTrue("Expected not ended", !ended);
        transactionEnlistingInterceptor.returnConnection(connectionInfo, ConnectionReturnAction.RETURN_HANDLE);
        assertTrue("Expected returned", returned);
View Full Code Here

Examples of org.apache.geronimo.transaction.UnspecifiedTransactionContext

    private Object mutex = new Object();

    private Exception e = null;

    public void testNoTransactionCallOneThread() throws Throwable {
        TransactionContext.setContext(new UnspecifiedTransactionContext());
        for (int i = 0; i < repeatCount; i++) {
            defaultComponentInterceptor.invoke(defaultComponentContext);
        }
    }
View Full Code Here

Examples of org.apache.geronimo.transaction.UnspecifiedTransactionContext

        startedThreads = 0;
        stoppedThreads = 0;
        for (int t = 0; t < threadCount; t++) {
            new Thread() {
                public void run() {
                    TransactionContext.setContext(new UnspecifiedTransactionContext());
                    long localStartTime = 0;
                    try {
                        synchronized (startBarrier) {
                            ++startedThreads;
                            startBarrier.notifyAll();
View Full Code Here

Examples of org.apache.geronimo.transaction.UnspecifiedTransactionContext

        transactionManager.commit();
        assertNotNull("Should be committed", mockXAResource.getCommitted());
    }

    public void testNoTransactionCall() throws Throwable {
        TransactionContext.setContext(new UnspecifiedTransactionContext());
        defaultComponentInterceptor.invoke(defaultComponentContext);
        MockXAResource mockXAResource = (MockXAResource) mockManagedConnection.getXAResource();
        assertEquals("XAResource should know 0 xid", 0, mockXAResource.getKnownXids().size());
        assertNull("Should not be committed", mockXAResource.getCommitted());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.