Package javax.transaction

Examples of javax.transaction.SystemException


    @Test( expected = RuntimeException.class )
    public void getRollbackOnlyWithSystemException()
        throws Exception
    {
        doThrow( new SystemException() ).when( txn ).getStatus();
        sut.getRollbackOnly();
    }
View Full Code Here


    @Test( expected = RuntimeException.class )
    public void isActiveWithSystemException()
        throws Exception
    {
        doThrow( new SystemException() ).when( txn ).getStatus();
        sut.isActive();
    }
View Full Code Here

                            activeConn.start();
                            LOGGER.debug("new namedXAResource's connection: " + activeConn);

                            return new ConnectionAndWrapperNamedXAResource(session.getXAResource(), getName(), activeConn);
                        } catch (Exception e) {
                            SystemException se =  new SystemException("Failed to create ConnectionAndWrapperNamedXAResource, " + e.getLocalizedMessage());
                            se.initCause(e);
                            LOGGER.error(se.getLocalizedMessage(), se);
                            throw se;
                        }
                    }

                    public void returnNamedXAResource(NamedXAResource namedXaResource) {
View Full Code Here

    //ResourceManager implementation
    public NamedXAResource getRecoveryXAResources() throws SystemException {
        try {
            return connectionManagerContainer.getRecoveryXAResource(managedConnectionFactory);
        } catch (ResourceException e) {
            throw (SystemException) new SystemException("Could not obtain recovery XAResource for managedConnectionFactory " + objectName).initCause(e);
        }
    }
View Full Code Here

            if (xaResources == null || xaResources.length == 0) {
                return null;
            }
            return new WrapperNamedXAResource(xaResources[0], containerId);
        } catch (ResourceException e) {
            throw (SystemException) new SystemException("Could not get XAResource for recovery for mdb: " + containerId).initCause(e);
        }
    }
View Full Code Here

        this.transaction = transaction;
    }

    void begin(long transactionTimeoutMilliseconds) throws SystemException, NotSupportedException {
        if (transaction != null) {
            throw new SystemException("Context is already associated with a transaction");
        }
        transaction = txnManager.begin(transactionTimeoutMilliseconds);
        threadAssociated = true;
    }
View Full Code Here

    }

    public void suspend() throws SystemException {
        Transaction suspendedTransaction = txnManager.suspend();
        if (transaction != suspendedTransaction) {
            throw new SystemException("Suspend did not return our transaction: expectedTx=" + transaction + ", suspendedTx=" + suspendedTransaction);
        }
        threadAssociated = false;
    }
View Full Code Here

        } catch (RuntimeException e) {
            throw e;
        } catch (Error e) {
            throw e;
        } catch (Exception e) {
            throw (SystemException) new SystemException("After commit of container transaction failed").initCause(e);
        }
    }
View Full Code Here

            // verify our tx is the current tx associated with the thread
            // this is really only an error case and should never happen, but just to be sure double check
            // immedately before committing using the transaction manager
            Transaction currentTransaction = txnManager.getTransaction();
            if (currentTransaction != transaction) {
                throw new SystemException("An unknown transaction is currently associated with the thread: expectedTx=" + transaction + ", currentTx=" + currentTransaction);
            }

            txnManager.commit();
            wasCommitted = true;
        } catch (Throwable t) {
View Full Code Here

        if (firstThrowable instanceof Error) {
            throw (Error) firstThrowable;
        } else if (firstThrowable instanceof Exception) {
            throw (Exception) firstThrowable;
        } else if (firstThrowable != null) {
            throw (SystemException) new SystemException().initCause(firstThrowable);
        }
    }
View Full Code Here

TOP

Related Classes of javax.transaction.SystemException

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.