Examples of HeuristicMixedException


Examples of javax.transaction.HeuristicMixedException

      for (XAResource res : resources) {
         try {
            res.commit(xid, false);//todo we only support one phase commit for now, change this!!!
         } catch (XAException e) {
            log.warn("exception while committing",e);
            throw new HeuristicMixedException(e.getMessage());
         }
      }
      return true;
   }
View Full Code Here

Examples of javax.transaction.HeuristicMixedException

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

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

Examples of javax.transaction.HeuristicMixedException

                    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

Examples of javax.transaction.HeuristicMixedException

        }
        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

Examples of javax.transaction.HeuristicMixedException

                        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

Examples of javax.transaction.HeuristicMixedException

                        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

Examples of javax.transaction.HeuristicMixedException

         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

Examples of javax.transaction.HeuristicMixedException

         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

Examples of javax.transaction.HeuristicMixedException

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