Package org.apache.geronimo.transaction.context

Examples of org.apache.geronimo.transaction.context.TransactionContext.commit()


        assertTrue("Expected the same ManagedConnectionInfo in the TransactionContext as was returned",
                connectionInfo2.getManagedConnectionInfo() == getSharedManagedConnectionInfo(transactionContext2));
        //commit 2nd transaction, see if connection returned.
        //we didn't create any handles, so the "ManagedConnection" should be returned.
        assertTrue("Expected TransactionContext to report active", transactionContext2.isActive());
        transactionContext2.commit();
        assertTrue("Expected connection to be returned", returnedConnectionInfo != null);
        assertTrue("Expected TransactionContext to report inactive", !transactionContext2.isActive());
        returnedConnectionInfo = null;
        //resume first transaction
        transactionContext1.resume();
View Full Code Here


        for (long i = 0; i < COUNT; i++) {
            timer.schedule(userTaskFactory, key, userId, userKey, i);
        }
        Thread.sleep(COUNT + SLOP);
        assertEquals(0, counter.get());
        transactionContext.commit();
        Thread.sleep(COUNT + SLOP);
        assertEquals(COUNT, counter.get());
    }

    public void testCancelInCommittedTransaction() throws Exception {
View Full Code Here

        for (int i = 0; i < workInfos.length; i++) {
            workInfos[i].getExecutorFeedingTimerTask().cancel();
        }
        Thread.sleep(SLOP + DELAY);
        assertEquals(COUNT, counter.get());
        transactionContext.commit();
        Thread.sleep(SLOP + DELAY);
        assertEquals(COUNT, counter.get());
    }

    public void testCancelInRolledBackTransaction() throws Exception {
View Full Code Here

            if (workInfo.isOneTime()) {
                threadPooledTimer.removeWorkInfo(workInfo);
            }
        } finally {
            try {
                transactionContext.commit();
            } catch (Exception e) {
                log.error("Unable to commit transaction context", e);
            }
            transactionContextManager.setContext(oldTransactionContext);
        }
View Full Code Here

                    log.info("Exception occured while updating timer persistent state", e);
                }
            } finally {
                try {
                    transactionContextManager.setContext(null);
                    if (transactionContext.commit()) {
                        if (workInfo.isOneTime()) {
                            threadPooledTimer.removeWorkInfo(workInfo);
                        }
                        // todo this is a very weird code structure.... returning from a finally is very confusing
                        return;
View Full Code Here

        started = false;
        transactionEnlistingInterceptor.returnConnection(connectionInfo, ConnectionReturnAction.RETURN_HANDLE);
        assertTrue("Expected not started", !started);
        assertTrue("Expected ended", ended);
        assertTrue("Expected returned", returned);
        transactionContext.commit();
        assertTrue("Expected committed", committed);
    }

    public void testTransactionUnshareableConnection() throws Exception {
        TransactionContext transactionContext = transactionContextManager.newContainerTransactionContext();
View Full Code Here

            jndiContext.stopClient(appClientModuleName);

            thread.setContextClassLoader(oldClassLoader);
            transactionContextManager.setContext(oldTransactionContext);
            if (currentTransactionContext != null) {
                currentTransactionContext.commit();
            }
            ContextManager.setCurrentCaller(oldCurrentCaller);
        }
    }
View Full Code Here

        started = false;
        transactionEnlistingInterceptor.returnConnection(connectionInfo, ConnectionReturnAction.RETURN_HANDLE);
        assertTrue("Expected not started", !started);
        assertTrue("Expected ended", ended);
        assertTrue("Expected returned", returned);
        transactionContext.commit();
        assertTrue("Expected committed", committed);
    }

    //ConnectionInterceptor
    public void getConnection(ConnectionInfo connectionInfo) throws ResourceException {
View Full Code Here

        TransactionContext transactionContext = transactionContextManager.newContainerTransactionContext();
        defaultComponentInterceptor.invoke(defaultComponentContext);
        MockXAResource mockXAResource = (MockXAResource) mockManagedConnection.getXAResource();
        assertEquals("XAResource should know one xid", 1, mockXAResource.getKnownXids().size());
        assertNull("Should not be committed", mockXAResource.getCommitted());
        transactionContext.commit();
        assertNotNull("Should be committed", mockXAResource.getCommitted());
    }

    public void testNoTransactionCall() throws Throwable {
        transactionContextManager.newUnspecifiedTransactionContext();
View Full Code Here

        assertNull("Should not be committed", mockXAResource.getCommitted());
        defaultComponentInterceptor.invoke(defaultComponentContext);
        assertEquals("Expected same XAResource", mockXAResource, mockManagedConnection.getXAResource());
        assertEquals("XAResource should know one xid", 1, mockXAResource.getKnownXids().size());
        assertNull("Should not be committed", mockXAResource.getCommitted());
        transactionContext.commit();
        assertNotNull("Should be committed", mockXAResource.getCommitted());
    }

    public void testUserTransactionEnlistingExistingConnections() throws Throwable {
        mockComponent = new DefaultInterceptor() {
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.