Package org.apache.geronimo.transaction.context

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


        } finally {
            jndiContext.stopClient(appClientModuleName);

            thread.setContextClassLoader(contextClassLoader);
            transactionContextManager.setContext(oldTransactionContext);
            currentTransactionContext.commit();
        }
    }

    public static final GBeanInfo GBEAN_INFO;
View Full Code Here


                        if (newTransactionContext != transactionContextManager.getContext()) {
                            transactionContextManager.getContext().rollback();
                            newTransactionContext.rollback();
                            throw new HttpException(500, "WRONG EXCEPTION! returned from servlet call with wrong tx context");
                        }
                        newTransactionContext.commit();

                    } else {
                        if (oldTransactionContext != transactionContextManager.getContext()) {
                            if (transactionContextManager.getContext() != null) {
                                transactionContextManager.getContext().rollback();
View Full Code Here

                    super.doStart();
                } finally {
                    if (transactionContext != null) {
                        transactionContextManager.setContext(null);
                        try {
                            transactionContext.commit();
                        } catch (Exception e) {
                            //TODO this is undoubtedly the wrong error code!
                            throw (HttpException) new HttpException(500, "Problem committing unspecified transaction context").initCause(e);
                        }
                    }
View Full Code Here

                    }
                } finally {
                    if (transactionContext != null) {
                        transactionContextManager.setContext(null);
                        try {
                            transactionContext.commit();
                        } catch (Exception e) {
                            //TODO this is undoubtedly the wrong error code!
                            throw (HttpException) new HttpException(500, "Problem committing unspecified transaction context").initCause(e);
                        }
                    }
View Full Code Here

        for (long i = 0; i < COUNT; i++) {
            timer.schedule(userTaskFactory, key, userId, userKey, i);
        }
        Thread.currentThread().sleep(COUNT + SLOP);
        assertEquals(0, counter.get());
        transactionContext.commit();
        Thread.currentThread().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.currentThread().sleep(SLOP + DELAY);
        assertEquals(COUNT, counter.get());
        transactionContext.commit();
        Thread.currentThread().sleep(SLOP + DELAY);
        assertEquals(COUNT, counter.get());
    }

    public void testCancelInRolledBackTransaction() throws Exception {
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

        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());
    }
}
View Full Code Here

        assertTrue("Expected the same ManagedConnectionInfo in the TransactionContext as was returned",
                connectionInfo1.getManagedConnectionInfo() == getSharedManagedConnectionInfo(transactionContext));
        //commit, see if connection returned.
        //we didn't create any handles, so the "ManagedConnection" should be returned.
        assertTrue("Expected TransactionContext to report active", transactionContext.isActive());
        transactionContext.commit();
        assertTrue("Expected connection to be returned", returnedConnectionInfo != null);
        assertTrue("Expected TransactionContext to report inactive", !transactionContext.isActive());

    }
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.