Package javax.transaction

Examples of javax.transaction.HeuristicMixedException


       
        if (cause == null) {
            throw (RollbackException) new RollbackException("Unable to commit: transaction marked for rollback").initCause(cause);
        } else {
            if (cause.errorCode == XAException.XA_HEURCOM && everRolledback) {
                throw (HeuristicMixedException) new HeuristicMixedException("HeuristicMixed error during commit/rolling back").initCause(cause);
            } else if (cause.errorCode == XAException.XA_HEURMIX) {
                throw (HeuristicMixedException) new HeuristicMixedException("HeuristicMixed error during commit/rolling back").initCause(cause);
            } else {           
                throw (SystemException) new SystemException("System Error during commit/rolling back").initCause(cause);
            }
        }
    }
View Full Code Here


                    manager.getCommitter().forget(manager.getBranchId());
                    //throw (HeuristicRollbackException) new HeuristicRollbackException("Error during one-phase commit").initCause(e);
                } else if (e.errorCode == XAException.XA_HEURMIX) {
                    cause = e;
                    manager.getCommitter().forget(manager.getBranchId());
                    throw (HeuristicMixedException) new HeuristicMixedException("Error during one-phase commit").initCause(e);
                } else if (e.errorCode == XAException.XA_HEURCOM) {
                    // let's not throw an exception as the transaction has been committed
                    log.info("Transaction has been heuristically committed");
                    manager.getCommitter().forget(manager.getBranchId());
                } else if (e.errorCode == XAException.XA_RBROLLBACK
                        || e.errorCode == XAException.XAER_RMERR
                        || e.errorCode == XAException.XAER_NOTA) {
                    // Per XA spec, XAException.XAER_RMERR from commit means An error occurred in
                    // committing the work performed on behalf of the transaction branch
                    // and the branch�s work has been rolled back.
                    // XAException.XAER_NOTA:  ssume the DB took a unilateral rollback decision and forgot the transaction
                    log.info("Transaction has been rolled back");
                    cause = e;
                    // throw (RollbackException) new RollbackException("Error during one-phase commit").initCause(e);                       
                } else {
                    cause = e;
                    //throw (SystemException) new SystemException("Error during one-phase commit").initCause(e);
                }                   
            }
        } catch (XAException e) {
            if (e.errorCode == XAException.XAER_NOTA) {
                // NOTA in response to forget, means the resource already forgot the transaction
                // ignore
            } else {
                throw (SystemException) new SystemException("Error during one phase commit").initCause(e);
            }
        }
       
        if (cause != null) {
            if (cause.errorCode == XAException.XA_HEURRB) {
                throw (HeuristicRollbackException) new HeuristicRollbackException("Error during two phase commit").initCause(cause);
            } else if (cause.errorCode == XAException.XA_HEURMIX) {
                throw (HeuristicMixedException) new HeuristicMixedException("Error during two phase commit").initCause(cause);
            } else if (cause.errorCode == XAException.XA_RBROLLBACK
                    || cause.errorCode == XAException.XAER_RMERR
                    || cause.errorCode == XAException.XAER_NOTA) {
                throw (RollbackException) new RollbackException("Error during two phase commit").initCause(cause);
            } else {
View Full Code Here

        }
        if (cause != null) {
            if (cause.errorCode == XAException.XA_HEURRB && !evercommit) {
                throw (HeuristicRollbackException) new HeuristicRollbackException("Error during two phase commit").initCause(cause);
            } else if (cause.errorCode == XAException.XA_HEURRB && evercommit) {
                throw (HeuristicMixedException) new HeuristicMixedException("Error during two phase commit").initCause(cause);
            } else if (cause.errorCode == XAException.XA_HEURMIX) {
                throw (HeuristicMixedException) new HeuristicMixedException("Error during two phase commit").initCause(cause);
            } else {
                throw (SystemException) new SystemException("Error during two phase commit").initCause(cause);
            }
        }
    }
View Full Code Here

                        case ActionStatus.ABORTING:
                        case ActionStatus.H_ROLLBACK:
                                throw new HeuristicRollbackException();
                        case ActionStatus.H_HAZARD:
                        case ActionStatus.H_MIXED:
                            throw new HeuristicMixedException();
                        case ActionStatus.INVALID:
                                throw new IllegalStateException();
                        default:
                                throw new HeuristicMixedException(); // not sure what happened,
                        // so err on the safe side!
                        }
                }
                catch (ClassCastException ex)
                {
View Full Code Here

                        case ActionStatus.COMMITTING:
                        case ActionStatus.H_COMMIT:
                                throw new HeuristicCommitException();
                        case ActionStatus.H_HAZARD:
                        case ActionStatus.H_MIXED:
                                throw new HeuristicMixedException();
                        default:
                                throw new HeuristicMixedException();
                        }
                }
                catch (ClassCastException ex)
                {
                        ex.printStackTrace();
View Full Code Here

         try {
            //we only do 2-phase commits
            res.commit(xid, false);
         } catch (XAException e) {
            log.warn("exception while committing", e);
            throw new HeuristicMixedException(e.getMessage());
         }
      }
      return true;
   }
View Full Code Here

         try {
            //we only do 2-phase commits
            res.commit(xid, false);
         } catch (XAException e) {
            log.warn("exception while committing", e);
            throw new HeuristicMixedException(e.getMessage());
         }
      }
      return true;
   }
View Full Code Here

   {
      switch (nHeuristic)
      {
         case XAException.XA_HEURHAZ:
         case XAException.XA_HEURMIX:
            throw new HeuristicMixedException("Heuristic mixed result of transaction " + this);
        
         case XAException.XA_HEURRB:
            throw new HeuristicRollbackException("Heuristic rollback of transaction " + this);
      }
   }
View Full Code Here

            case HeuristicCompletionException.STATE_ROLLED_BACK:
               log.error("Exception cause:", e);
               throw new HeuristicRollbackException(e.getMessage());
            default:
               log.error("Exception cause:", e);
               throw new HeuristicMixedException(e.getMessage());
         }
      }
      catch (TransactionSystemException e)
      {
         log.error("Exception cause:", e);
View Full Code Here

/*      */       {
/*      */       case 6:
/*      */       case 7:
/*  248 */         break;
/*      */       case 13:
/*  250 */         throw new HeuristicMixedException();
/*      */       case 14:
/*  252 */         throw new HeuristicMixedException();
/*      */       case 4:
/*      */       case 11:
/*  255 */         RollbackException rollbackException = new RollbackException(jtaLogger.logMesg.getString("com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted"));
/*      */
/*  258 */         if (this._theTransaction.getDeferredThrowable() != null)
View Full Code Here

TOP

Related Classes of javax.transaction.HeuristicMixedException

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.