Examples of RollbackException


Examples of javax.transaction.RollbackException

        }
        switch (status) {
            case Status.STATUS_ACTIVE:
                break;
            case Status.STATUS_MARKED_ROLLBACK:
                throw new RollbackException("Transaction is marked for rollback");
            default:
                throw new IllegalStateException("Status is " + getStateString(status));
        }

        if (activeXaResources.containsKey(xaRes)) {
View Full Code Here

Examples of javax.transaction.RollbackException

            if (status == Status.STATUS_MARKED_ROLLBACK) {
                rollbackResources(resourceManagers);
                              if(timedout)
                              {
                                  throw new RollbackException("Transaction timout");
                              }
                              else
                              {
                                  throw new RollbackException("Unable to commit");
                              }
            }
            synchronized (this) {
                if (status == Status.STATUS_ACTIVE) {
                    if (this.resourceManagers.size() == 0) {
                        // nothing to commit
                        status = Status.STATUS_COMMITTED;
                    } else if (this.resourceManagers.size() == 1) {
                        // one-phase commit decision
                        status = Status.STATUS_COMMITTING;
                    } else {
                        // start prepare part of two-phase
                        status = Status.STATUS_PREPARING;
                    }
                }
                // resourceManagers is now immutable
            }


            // no-phase
            if (resourceManagers.size() == 0) {
                synchronized (this) {
                    status = Status.STATUS_COMMITTED;
                }
                return;
            }

            // one-phase
            if (resourceManagers.size() == 1) {
                TransactionBranch manager = (TransactionBranch) resourceManagers.getFirst();
                try {
                    manager.getCommitter().commit(manager.getBranchId(), true);
                    synchronized (this) {
                        status = Status.STATUS_COMMITTED;
                    }
                    return;
                } catch (XAException e) {
                    synchronized (this) {
                        status = Status.STATUS_ROLLEDBACK;
                    }
                    throw (RollbackException) new RollbackException("Error during one-phase commit").initCause(e);
                }
            }

            // two-phase
            boolean willCommit = internalPrepare();

            // notify the RMs
            if (willCommit) {
                commitResources(resourceManagers);
            } else {
                rollbackResources(resourceManagers);
                throw new RollbackException("Unable to commit");
            }
        } finally {
            afterCompletion();
            synchronized (this) {
                status = Status.STATUS_NO_TRANSACTION;
View Full Code Here

Examples of org.internna.iwebmvc.RollbackException

        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public OutboundVariable convertOutbound(Object data, OutboundContext context) throws ConversionException {
        RollbackException ex = (RollbackException) data;
        if ((data == null) || (ex.getValue() == null)) return new NonNestedOutboundVariable("null");
        return converterManager.convertOutbound(ex.getValue(), context);
    }
View Full Code Here

Examples of org.internna.iwebmvc.RollbackException

        }
        DomainEntity binded = parse(entity);
        Map<String, InvalidValue> errors = validate(binded);
        if (CollectionUtils.isEmpty(errors))
            errors = entity.getId() == null ? proceedWithNewEntity(entity): proceedWithExistingEntity(entity);
        if (!CollectionUtils.isEmpty(errors)) throw new RollbackException(errors);
        return errors;
    }
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.