Java Code Examples for javax.transaction.xa.XAException#XA_RETRY
The following examples show how to use
javax.transaction.xa.XAException#XA_RETRY .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractTransactionAssistanceXAResource.java From genericconnector with Apache License 2.0 | 6 votes |
@Override public void commit(Xid xid, boolean onePhase) throws XAException { String s = XidImpl.asString(xid); log.log(Level.INFO, "COMMIT " + onePhase + "/" + s); //regardless of onePhase, we need to tell the external system that we are done and //the previous call to the EXECUTE method should be COMMITTED. try{ getUnderlyingConnection().commit(s); if(isHandleRecoveryInternally()){ cleanupInternalTransactionState(xid); } getUnderlyingConnection().cleanup(); }catch(Exception e){ log.log(Level.SEVERE, "Failed to COMMIT", e); int var = XAException.XA_RETRY; throw new XAException(var); } }
Example 2
Source File: AbstractTransactionAssistanceXAResource.java From genericconnector with Apache License 2.0 | 6 votes |
@Override public void rollback(Xid xid) throws XAException { String s = XidImpl.asString(xid); log.log(Level.INFO, "ROLLBACK " + s); try{ getUnderlyingConnection().rollback(s); if(isHandleRecoveryInternally()){ cleanupInternalTransactionState(xid); } getUnderlyingConnection().cleanup(); }catch(Exception e){ log.log(Level.WARNING, "failed to rollback for txid " + s, e); throw new XAException(XAException.XA_RETRY); } }
Example 3
Source File: XATestUtil.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
/** * Return a string for the error code of the XAException. */ public static String errorCode(XAException e) { String error; switch(e.errorCode) { case XAException.XA_HEURCOM : error = "XA_HEURCOM "; break; case XAException.XA_HEURHAZ : error = "XA_HEURHAZ"; break; case XAException.XA_HEURMIX : error = "XA_HEURMIX"; break; case XAException.XA_HEURRB : error = "XA_HEURRB "; break; case XAException.XA_NOMIGRATE : error = "XA_NOMIGRATE "; break; case XAException.XA_RBCOMMFAIL : error = "XA_RBCOMMFAIL "; break; case XAException.XA_RBDEADLOCK : error = "XA_RBDEADLOCK "; break; case XAException.XA_RBINTEGRITY : error = "XA_RBINTEGRITY "; break; case XAException.XA_RBOTHER : error = "XA_RBOTHER "; break; case XAException.XA_RBPROTO : error = "XA_RBPROTO "; break; case XAException.XA_RBROLLBACK : error = "XA_RBROLLBACK "; break; case XAException.XA_RBTIMEOUT : error = "XA_RBTIMEOUT "; break; case XAException.XA_RBTRANSIENT : error = "XA_RBTRANSIENT "; break; case XAException.XA_RDONLY : error = "XA_RDONLY "; break; case XAException.XA_RETRY : error = "XA_RETRY "; break; case XAException.XAER_ASYNC : error = "XAER_ASYNC "; break; case XAException.XAER_DUPID : error = "XAER_DUPID "; break; case XAException.XAER_INVAL : error = "XAER_INVAL "; break; case XAException.XAER_NOTA : error = "XAER_NOTA "; break; case XAException.XAER_OUTSIDE : error = "XAER_OUTSIDE "; break; case XAException.XAER_PROTO : error = "XAER_PROTO "; break; case XAException.XAER_RMERR : error = "XAER_RMERR "; break; case XAException.XAER_RMFAIL : error = "XAER_RMFAIL "; break; default: error = Integer.toString(e.errorCode); break; } return error; }
Example 4
Source File: XATestUtil.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
/** * Return a string for the error code of the XAException. */ public static String errorCode(XAException e) { String error; switch(e.errorCode) { case XAException.XA_HEURCOM : error = "XA_HEURCOM "; break; case XAException.XA_HEURHAZ : error = "XA_HEURHAZ"; break; case XAException.XA_HEURMIX : error = "XA_HEURMIX"; break; case XAException.XA_HEURRB : error = "XA_HEURRB "; break; case XAException.XA_NOMIGRATE : error = "XA_NOMIGRATE "; break; case XAException.XA_RBCOMMFAIL : error = "XA_RBCOMMFAIL "; break; case XAException.XA_RBDEADLOCK : error = "XA_RBDEADLOCK "; break; case XAException.XA_RBINTEGRITY : error = "XA_RBINTEGRITY "; break; case XAException.XA_RBOTHER : error = "XA_RBOTHER "; break; case XAException.XA_RBPROTO : error = "XA_RBPROTO "; break; case XAException.XA_RBROLLBACK : error = "XA_RBROLLBACK "; break; case XAException.XA_RBTIMEOUT : error = "XA_RBTIMEOUT "; break; case XAException.XA_RBTRANSIENT : error = "XA_RBTRANSIENT "; break; case XAException.XA_RDONLY : error = "XA_RDONLY "; break; case XAException.XA_RETRY : error = "XA_RETRY "; break; case XAException.XAER_ASYNC : error = "XAER_ASYNC "; break; case XAException.XAER_DUPID : error = "XAER_DUPID "; break; case XAException.XAER_INVAL : error = "XAER_INVAL "; break; case XAException.XAER_NOTA : error = "XAER_NOTA "; break; case XAException.XAER_OUTSIDE : error = "XAER_OUTSIDE "; break; case XAException.XAER_PROTO : error = "XAER_PROTO "; break; case XAException.XAER_RMERR : error = "XAER_RMERR "; break; case XAException.XAER_RMFAIL : error = "XAER_RMFAIL "; break; default: error = Integer.toString(e.errorCode); break; } return error; }
Example 5
Source File: XATestUtil.java From spliceengine with GNU Affero General Public License v3.0 | 5 votes |
/** * Return a string for the error code of the XAException. */ public static String errorCode(XAException e) { String error; switch(e.errorCode) { case XAException.XA_HEURCOM : error = "XA_HEURCOM "; break; case XAException.XA_HEURHAZ : error = "XA_HEURHAZ"; break; case XAException.XA_HEURMIX : error = "XA_HEURMIX"; break; case XAException.XA_HEURRB : error = "XA_HEURRB "; break; case XAException.XA_NOMIGRATE : error = "XA_NOMIGRATE "; break; case XAException.XA_RBCOMMFAIL : error = "XA_RBCOMMFAIL "; break; case XAException.XA_RBDEADLOCK : error = "XA_RBDEADLOCK "; break; case XAException.XA_RBINTEGRITY : error = "XA_RBINTEGRITY "; break; case XAException.XA_RBOTHER : error = "XA_RBOTHER "; break; case XAException.XA_RBPROTO : error = "XA_RBPROTO "; break; case XAException.XA_RBROLLBACK : error = "XA_RBROLLBACK "; break; case XAException.XA_RBTIMEOUT : error = "XA_RBTIMEOUT "; break; case XAException.XA_RBTRANSIENT : error = "XA_RBTRANSIENT "; break; case XAException.XA_RDONLY : error = "XA_RDONLY "; break; case XAException.XA_RETRY : error = "XA_RETRY "; break; case XAException.XAER_ASYNC : error = "XAER_ASYNC "; break; case XAException.XAER_DUPID : error = "XAER_DUPID "; break; case XAException.XAER_INVAL : error = "XAER_INVAL "; break; case XAException.XAER_NOTA : error = "XAER_NOTA "; break; case XAException.XAER_OUTSIDE : error = "XAER_OUTSIDE "; break; case XAException.XAER_PROTO : error = "XAER_PROTO "; break; case XAException.XAER_RMERR : error = "XAER_RMERR "; break; case XAException.XAER_RMFAIL : error = "XAER_RMFAIL "; break; default: error = Integer.toString(e.errorCode); break; } return error; }
Example 6
Source File: xaHelper.java From gemfirexd-oss with Apache License 2.0 | 4 votes |
private void handleException(Throwable t) throws SQLException { if (t instanceof SQLException) { // let ij handle it throw (SQLException)t; } if (t instanceof XAException) { int errorCode = ((XAException)t).errorCode; String error = LocalizedResource.getMessage("IJ_IlleValu"); // XA_RBBASE 100 // XA_RBROLLBACK 100 // XA_RBCOMMFAIL 101 // XA_RBDEADLOCK 102 // XA_RBINTEGRITY 103 // XA_RBOTHER 104 // XA_RBPROTO 105 // XA_RBTIMEOUT 106 // XA_RBTRANSIENT 107 // XA_RBEND 107 // // XA_RDONLY 3 // XA_RETRY 4 // XA_HEURMIX 5 // XA_HEURRB 6 // XA_HEURCOM 7 // XA_HEURHAZ 8 // XA_NOMIGRATE 9 // // XAER_ASYNC -2 // XAER_RMERR -3 // XAER_NOTA -4 // XAER_INVAL -5 // XAER_PROTO -6 // XAER_RMFAIL -7 // XAER_DUPID -8 // XAER_OUTSIDE -9 switch(errorCode) { case XAException.XA_HEURCOM : error = "XA_HEURCOM "; break; case XAException.XA_HEURHAZ : error = "XA_HEURHAZ"; break; case XAException.XA_HEURMIX : error = "XA_HEURMIX"; break; case XAException.XA_HEURRB : error = "XA_HEURRB "; break; case XAException.XA_NOMIGRATE : error = "XA_NOMIGRATE "; break; // case XAException.XA_RBBASE : error = "XA_RBBASE "; break; case XAException.XA_RBCOMMFAIL : error = "XA_RBCOMMFAIL "; break; case XAException.XA_RBDEADLOCK : error = "XA_RBDEADLOCK "; break; // case XAException.XA_RBEND : error = "XA_RBEND "; break; case XAException.XA_RBINTEGRITY : error = "XA_RBINTEGRITY "; break; case XAException.XA_RBOTHER : error = "XA_RBOTHER "; break; case XAException.XA_RBPROTO : error = "XA_RBPROTO "; break; case XAException.XA_RBROLLBACK : error = "XA_RBROLLBACK "; break; case XAException.XA_RBTIMEOUT : error = "XA_RBTIMEOUT "; break; case XAException.XA_RBTRANSIENT : error = "XA_RBTRANSIENT "; break; case XAException.XA_RDONLY : error = "XA_RDONLY "; break; case XAException.XA_RETRY : error = "XA_RETRY "; break; case XAException.XAER_ASYNC : error = "XAER_ASYNC "; break; case XAException.XAER_DUPID : error = "XAER_DUPID "; break; case XAException.XAER_INVAL : error = "XAER_INVAL "; break; case XAException.XAER_NOTA : error = "XAER_NOTA "; break; case XAException.XAER_OUTSIDE : error = "XAER_OUTSIDE "; break; case XAException.XAER_PROTO : error = "XAER_PROTO "; break; case XAException.XAER_RMERR : error = "XAER_RMERR "; break; case XAException.XAER_RMFAIL : error = "XAER_RMFAIL "; break; } //t.printStackTrace(System.out); throw new ijException(error); } else // StandardException or run time exception, log it first { String info = LocalizedResource.getMessage("IJ_01SeeLog", t.toString(), t.getMessage()); // t.printStackTrace(System.out); throw new ijException(info); } }
Example 7
Source File: XATransactionState.java From gemfirexd-oss with Apache License 2.0 | 4 votes |
void start(EmbedXAResource resource, int flags) throws XAException { synchronized (this) { if (associationState == XATransactionState.TRO_FAIL) throw new XAException(rollbackOnlyCode); boolean isSuspendedByResource = (suspendedList != null) && (suspendedList.get(resource) != null); if (flags == XAResource.TMRESUME) { if (!isSuspendedByResource) throw new XAException(XAException.XAER_PROTO); } else { // cannot join a transaction we have suspended. if (isSuspendedByResource) throw new XAException(XAException.XAER_PROTO); } while (associationState == XATransactionState.T1_ASSOCIATED) { try { wait(); } catch (InterruptedException ie) { throw new XAException(XAException.XA_RETRY); } } switch (associationState) { case XATransactionState.T0_NOT_ASSOCIATED: break; case XATransactionState.TRO_DEADLOCK: case XATransactionState.TRO_TIMEOUT: case XATransactionState.TRO_FAIL: throw new XAException(rollbackOnlyCode); default: throw new XAException(XAException.XAER_NOTA); } if (isPrepared) throw new XAException(XAException.XAER_PROTO); if (isSuspendedByResource) { suspendedList.remove(resource); } associationState = XATransactionState.T1_ASSOCIATED; associatedResource = resource; } }
Example 8
Source File: xaHelper.java From gemfirexd-oss with Apache License 2.0 | 4 votes |
private void handleException(Throwable t) throws SQLException { if (t instanceof SQLException) { // let ij handle it throw (SQLException)t; } if (t instanceof XAException) { int errorCode = ((XAException)t).errorCode; String error = LocalizedResource.getMessage("IJ_IlleValu"); // XA_RBBASE 100 // XA_RBROLLBACK 100 // XA_RBCOMMFAIL 101 // XA_RBDEADLOCK 102 // XA_RBINTEGRITY 103 // XA_RBOTHER 104 // XA_RBPROTO 105 // XA_RBTIMEOUT 106 // XA_RBTRANSIENT 107 // XA_RBEND 107 // // XA_RDONLY 3 // XA_RETRY 4 // XA_HEURMIX 5 // XA_HEURRB 6 // XA_HEURCOM 7 // XA_HEURHAZ 8 // XA_NOMIGRATE 9 // // XAER_ASYNC -2 // XAER_RMERR -3 // XAER_NOTA -4 // XAER_INVAL -5 // XAER_PROTO -6 // XAER_RMFAIL -7 // XAER_DUPID -8 // XAER_OUTSIDE -9 switch(errorCode) { case XAException.XA_HEURCOM : error = "XA_HEURCOM "; break; case XAException.XA_HEURHAZ : error = "XA_HEURHAZ"; break; case XAException.XA_HEURMIX : error = "XA_HEURMIX"; break; case XAException.XA_HEURRB : error = "XA_HEURRB "; break; case XAException.XA_NOMIGRATE : error = "XA_NOMIGRATE "; break; // case XAException.XA_RBBASE : error = "XA_RBBASE "; break; case XAException.XA_RBCOMMFAIL : error = "XA_RBCOMMFAIL "; break; case XAException.XA_RBDEADLOCK : error = "XA_RBDEADLOCK "; break; // case XAException.XA_RBEND : error = "XA_RBEND "; break; case XAException.XA_RBINTEGRITY : error = "XA_RBINTEGRITY "; break; case XAException.XA_RBOTHER : error = "XA_RBOTHER "; break; case XAException.XA_RBPROTO : error = "XA_RBPROTO "; break; case XAException.XA_RBROLLBACK : error = "XA_RBROLLBACK "; break; case XAException.XA_RBTIMEOUT : error = "XA_RBTIMEOUT "; break; case XAException.XA_RBTRANSIENT : error = "XA_RBTRANSIENT "; break; case XAException.XA_RDONLY : error = "XA_RDONLY "; break; case XAException.XA_RETRY : error = "XA_RETRY "; break; case XAException.XAER_ASYNC : error = "XAER_ASYNC "; break; case XAException.XAER_DUPID : error = "XAER_DUPID "; break; case XAException.XAER_INVAL : error = "XAER_INVAL "; break; case XAException.XAER_NOTA : error = "XAER_NOTA "; break; case XAException.XAER_OUTSIDE : error = "XAER_OUTSIDE "; break; case XAException.XAER_PROTO : error = "XAER_PROTO "; break; case XAException.XAER_RMERR : error = "XAER_RMERR "; break; case XAException.XAER_RMFAIL : error = "XAER_RMFAIL "; break; } //t.printStackTrace(System.out); throw new ijException(error); } else // StandardException or run time exception, log it first { String info = LocalizedResource.getMessage("IJ_01SeeLog", t.toString(), t.getMessage()); // t.printStackTrace(System.out); throw new ijException(info); } }
Example 9
Source File: XATransactionState.java From gemfirexd-oss with Apache License 2.0 | 4 votes |
void start(EmbedXAResource resource, int flags) throws XAException { synchronized (this) { if (associationState == XATransactionState.TRO_FAIL) throw new XAException(rollbackOnlyCode); boolean isSuspendedByResource = (suspendedList != null) && (suspendedList.get(resource) != null); if (flags == XAResource.TMRESUME) { if (!isSuspendedByResource) throw new XAException(XAException.XAER_PROTO); } else { // cannot join a transaction we have suspended. if (isSuspendedByResource) throw new XAException(XAException.XAER_PROTO); } while (associationState == XATransactionState.T1_ASSOCIATED) { try { wait(); } catch (InterruptedException ie) { throw new XAException(XAException.XA_RETRY); } } switch (associationState) { case XATransactionState.T0_NOT_ASSOCIATED: break; case XATransactionState.TRO_DEADLOCK: case XATransactionState.TRO_TIMEOUT: case XATransactionState.TRO_FAIL: throw new XAException(rollbackOnlyCode); default: throw new XAException(XAException.XAER_NOTA); } if (isPrepared) throw new XAException(XAException.XAER_PROTO); if (isSuspendedByResource) { suspendedList.remove(resource); } associationState = XATransactionState.T1_ASSOCIATED; associatedResource = resource; } }
Example 10
Source File: XASupport.java From jTDS with GNU Lesser General Public License v2.1 | 4 votes |
/** * Construct and throw an <code>XAException</code> with an explanatory message and the XA error code set. * * @param errorCode the XA Error code * @exception javax.transaction.xa.XAException * the constructed exception */ public static void raiseXAException(int errorCode) throws XAException { String err = "xaerunknown"; switch (errorCode) { case XAException.XA_RBROLLBACK: err = "xarbrollback"; break; case XAException.XA_RBCOMMFAIL: err = "xarbcommfail"; break; case XAException.XA_RBDEADLOCK: err = "xarbdeadlock"; break; case XAException.XA_RBINTEGRITY: err = "xarbintegrity"; break; case XAException.XA_RBOTHER: err = "xarbother"; break; case XAException.XA_RBPROTO: err = "xarbproto"; break; case XAException.XA_RBTIMEOUT: err = "xarbtimeout"; break; case XAException.XA_RBTRANSIENT: err = "xarbtransient"; break; case XAException.XA_NOMIGRATE: err = "xanomigrate"; break; case XAException.XA_HEURHAZ: err = "xaheurhaz"; break; case XAException.XA_HEURCOM: err = "xaheurcom"; break; case XAException.XA_HEURRB: err = "xaheurrb"; break; case XAException.XA_HEURMIX: err = "xaheurmix"; break; case XAException.XA_RETRY: err = "xaretry"; break; case XAException.XA_RDONLY: err = "xardonly"; break; case XAException.XAER_ASYNC: err = "xaerasync"; break; case XAException.XAER_NOTA: err = "xaernota"; break; case XAException.XAER_INVAL: err = "xaerinval"; break; case XAException.XAER_PROTO: err = "xaerproto"; break; case XAException.XAER_RMERR: err = "xaerrmerr"; break; case XAException.XAER_RMFAIL: err = "xaerrmfail"; break; case XAException.XAER_DUPID: err = "xaerdupid"; break; case XAException.XAER_OUTSIDE: err = "xaeroutside"; break; } XAException e = new XAException(Messages.get("error.xaexception." + err)); e.errorCode = errorCode; Logger.println("XAException: " + e.getMessage()); throw e; }
Example 11
Source File: XATransactionState.java From spliceengine with GNU Affero General Public License v3.0 | 4 votes |
void start(EmbedXAResource resource, int flags) throws XAException { synchronized (this) { if (associationState == XATransactionState.TRO_FAIL) throw new XAException(rollbackOnlyCode); boolean isSuspendedByResource = (suspendedList != null) && (suspendedList.get(resource) != null); if (flags == XAResource.TMRESUME) { if (!isSuspendedByResource) throw new XAException(XAException.XAER_PROTO); } else { // cannot join a transaction we have suspended. if (isSuspendedByResource) throw new XAException(XAException.XAER_PROTO); } while (associationState == XATransactionState.T1_ASSOCIATED) { try { wait(); } catch (InterruptedException ie) { throw new XAException(XAException.XA_RETRY); } } switch (associationState) { case XATransactionState.T0_NOT_ASSOCIATED: break; case XATransactionState.TRO_DEADLOCK: case XATransactionState.TRO_TIMEOUT: case XATransactionState.TRO_FAIL: throw new XAException(rollbackOnlyCode); default: throw new XAException(XAException.XAER_NOTA); } if (isPrepared) throw new XAException(XAException.XAER_PROTO); if (isSuspendedByResource) { suspendedList.remove(resource); } associationState = XATransactionState.T1_ASSOCIATED; associatedResource = resource; } }
Example 12
Source File: xaHelper.java From spliceengine with GNU Affero General Public License v3.0 | 4 votes |
private void handleException(Throwable t) throws SQLException { if (t instanceof SQLException) { // let ij handle it throw (SQLException)t; } if (t instanceof XAException) { int errorCode = ((XAException)t).errorCode; String error = LocalizedResource.getMessage("IJ_IlleValu"); // XA_RBBASE 100 // XA_RBROLLBACK 100 // XA_RBCOMMFAIL 101 // XA_RBDEADLOCK 102 // XA_RBINTEGRITY 103 // XA_RBOTHER 104 // XA_RBPROTO 105 // XA_RBTIMEOUT 106 // XA_RBTRANSIENT 107 // XA_RBEND 107 // // XA_RDONLY 3 // XA_RETRY 4 // XA_HEURMIX 5 // XA_HEURRB 6 // XA_HEURCOM 7 // XA_HEURHAZ 8 // XA_NOMIGRATE 9 // // XAER_ASYNC -2 // XAER_RMERR -3 // XAER_NOTA -4 // XAER_INVAL -5 // XAER_PROTO -6 // XAER_RMFAIL -7 // XAER_DUPID -8 // XAER_OUTSIDE -9 switch(errorCode) { case XAException.XA_HEURCOM : error = "XA_HEURCOM "; break; case XAException.XA_HEURHAZ : error = "XA_HEURHAZ"; break; case XAException.XA_HEURMIX : error = "XA_HEURMIX"; break; case XAException.XA_HEURRB : error = "XA_HEURRB "; break; case XAException.XA_NOMIGRATE : error = "XA_NOMIGRATE "; break; // case XAException.XA_RBBASE : error = "XA_RBBASE "; break; case XAException.XA_RBCOMMFAIL : error = "XA_RBCOMMFAIL "; break; case XAException.XA_RBDEADLOCK : error = "XA_RBDEADLOCK "; break; // case XAException.XA_RBEND : error = "XA_RBEND "; break; case XAException.XA_RBINTEGRITY : error = "XA_RBINTEGRITY "; break; case XAException.XA_RBOTHER : error = "XA_RBOTHER "; break; case XAException.XA_RBPROTO : error = "XA_RBPROTO "; break; case XAException.XA_RBROLLBACK : error = "XA_RBROLLBACK "; break; case XAException.XA_RBTIMEOUT : error = "XA_RBTIMEOUT "; break; case XAException.XA_RBTRANSIENT : error = "XA_RBTRANSIENT "; break; case XAException.XA_RDONLY : error = "XA_RDONLY "; break; case XAException.XA_RETRY : error = "XA_RETRY "; break; case XAException.XAER_ASYNC : error = "XAER_ASYNC "; break; case XAException.XAER_DUPID : error = "XAER_DUPID "; break; case XAException.XAER_INVAL : error = "XAER_INVAL "; break; case XAException.XAER_NOTA : error = "XAER_NOTA "; break; case XAException.XAER_OUTSIDE : error = "XAER_OUTSIDE "; break; case XAException.XAER_PROTO : error = "XAER_PROTO "; break; case XAException.XAER_RMERR : error = "XAER_RMERR "; break; case XAException.XAER_RMFAIL : error = "XAER_RMFAIL "; break; } //t.printStackTrace(System.out); throw new ijException(error); } else // StandardException or run time exception, log it first { String info = LocalizedResource.getMessage("IJ_01SeeLog", t.toString(), t.getMessage()); // t.printStackTrace(System.out); throw new ijException(info); } }