public void setReenteredPreparedXid() throws CannotCommitException { if (_externalXid == null) throw new UnsupportedOperationException(); if (getState() == ABORTED) throw new CannotCommitException(" xtn is aborted"); _reenteredPreparedXid = true; modifyTxnState(VOTING); modifyTxnState(PREPARED); } }
int prepare(long waitFor) throws CannotCommitException, UnknownTransactionException, RemoteException { try { return commitImpl(waitFor, true /*prepareOnly*/); } catch (TimeoutExpiredException ex) { throw new CannotCommitException(getExternalXid().toString() + " " + ex.toString(), ex); } }
public void reenterPreparedExternalXid(Object xid, List<TransactionParticipant> parts) throws CannotCommitException { TxnManagerTransaction txntr = _txns.get(xid); if (txntr == null) { try { create(xid, Long.MAX_VALUE); } catch (LeaseDeniedException ex) { } //cant happen } txntr = _txns.get(xid); txntr.setReenteredPreparedXid(); //join the participants for (TransactionParticipant part : parts) { //TBDYP - xa-recover pass partition-id , proxy and cluster-name try { join_impl(xid, part, ServerTransaction.EMBEDDED_CRASH_COUNT, -1, true, null /*userXtnObject*/, -1 /*partitionId*/, null /*clusterName*/, null /*clusterProxy*/); } catch (Exception ex) { throw new CannotCommitException(" reason=" + ex.toString(), ex); } } }
private void prepareAndCommitPartitionWithEnabledFailover( ParticipantHandle singleHandle) throws CannotCommitException { TxnMgrProxy cur = (TxnMgrProxy) str.mgr; int res = PrepareAndCommitJob.commitAndPreparePartitionWithEnabledFailover(singleHandle, cur, str.id, _externalXid); if (res != COMMITTED) throw new CannotCommitException( "Unable to commit transaction: " + getParticipantInfo(), singleHandle.getCommitException()); modifyTxnState(COMMITTED); }
private void lightPrepareAndCommit(ParticipantHandle singleHandle) throws CannotCommitException, TimeoutExpiredException, RemoteException { try { if (modifyTxnState(VOTING)) { if (singleHandle.isSuitableForFailover()) { prepareAndCommitPartitionWithEnabledFailover(singleHandle); } else { TxnMgrProxy cur = (TxnMgrProxy) str.mgr; int res; if (_externalXid == null) res = singleHandle.getParticipant().prepareAndCommit(cur.createLightProxy(), str.id); else res = ((IRemoteSpace) (singleHandle.getParticipant())).prepareAndCommit(cur.createLightProxy(), _externalXid); if (res != COMMITTED) throw new CannotCommitException( "Unable to commit transaction: " + getParticipantInfo(), singleHandle.getCommitException()); modifyTxnState(res); } } else { if (getState() == COMMITTED) return; throw new CannotCommitException(); } } catch (UnknownTransactionException e) { throw new CannotCommitException(" reason=" + e, e); } }
vote = ABORTED; response = new Integer(vote); handle.setCommitException(new CannotCommitException("commit failed [ID=" + tr.id + "]: reason=" + rte, rte));
if ((curstate == ACTIVE) && !_leaseForEver && (ensureCurrent() == false)) { doAbort(0); throw new CannotCommitException("Lease expired [ID=" + +getTransaction().id + "]"); throw new CannotCommitException("attempt to commit " + "ABORTED transaction [ID=" + +getTransaction().id + "]"); throw new CannotCommitException("attempt to commit " + "ABORTED transaction [ID=" + +getTransaction().id + "]"); return COMMITTED; else throw new CannotCommitException("attempt to commit/prepare " + "ABORTED transaction [ID=" + +getTransaction().id + "]"); throw new CannotCommitException("transaction ABORTED [ID=" + +getTransaction().id + "]"); throw new CannotCommitException( "Unable to commit transaction [ID=" + +getTransaction().id + "]: " + getParticipantInfo(), getCommitExceptionCause(phs)); throw new CannotCommitException("attempt to commit " + "ABORTED transaction [ID=" + +getTransaction().id + "]"); throw new CannotCommitException("transaction " + "ABORTED [ID=" + +getTransaction().id + "]"); break; throw new CannotCommitException("transaction " +
private void lightCommit(ParticipantHandle singleHandle) throws CannotCommitException, TimeoutExpiredException, RemoteException { try { if (singleHandle.isSuitableForCommitFailover()) commitPartitionWithEnabledFailover(singleHandle); else { TxnMgrProxy cur = (TxnMgrProxy) str.mgr; if (_externalXid == null) singleHandle.getParticipant() .commit(cur.createLightProxy(), str.id); else ((IRemoteSpace) (singleHandle.getParticipant())).commit(cur.createLightProxy(), _externalXid); modifyTxnState(COMMITTED); } } catch (UnknownTransactionException e) { throw new CannotCommitException("[ID=" + str.id + "]: reason=" + e, e); } }
public static void commitPartitionWithEnabledFailover(ParticipantHandle handle, ExtendedTransactionManager mgr, long id, Object xid, int numPrepared) { try { //create request for the designated partition CommitPreparedTransactionSpaceOperationRequest request = null; OperationID operationID = handle.getClusterProxy().createNewOperationID(); if (xid == null) { request = new CommitPreparedTransactionSpaceOperationRequest(mgr, id, handle.getPartionId(), numPrepared, operationID); } else { request = new CommitPreparedTransactionSpaceOperationRequest(mgr, xid, handle.getPartionId(), numPrepared, operationID); } // call execute on router giving the request handle.getClusterProxy().getProxyRouter().execute(request); request.getRemoteOperationResult().processExecutionException(); } catch (Exception ex) { CannotCommitException ex1 = new CannotCommitException("commit failed [ID=" + id + "]: reason=" + ex, ex); handle.setCommitException(ex1); } }
if (getState() == COMMITTED || getState() == PREPARED) return getState(); throw new CannotCommitException(); throw new CannotCommitException(" reason=" + e, e);
public static int commitAndPreparePartitionWithEnabledFailover( ParticipantHandle handle, TransactionManager mgr, long id, Object xid) { try { // create request for the designated partition PrepareAndCommitTransactionSpaceOperationRequest request; OperationID operationID = handle.getClusterProxy().createNewOperationID(); if (xid == null) { request = new PrepareAndCommitTransactionSpaceOperationRequest(mgr, id, handle.getPartionId(), operationID); } else { request = new PrepareAndCommitTransactionSpaceOperationRequest(mgr, xid, handle.getPartionId(), operationID); } // call execute on router giving the request handle.getClusterProxy().getProxyRouter().execute(request); request.getRemoteOperationResult().processExecutionException(); return request.getRemoteOperationResult().getState(); } catch (Exception ex) { CannotCommitException ex1 = new CannotCommitException("commit failed [ID=" + id + "]: reason=" + ex, ex); handle.setCommitException(ex1); } return ABORTED; }