@Override public int prepare() throws XAException, IOException { if (LOG.isDebugEnabled()) { LOG.debug("XA Transaction prepare: " + xid); } switch (getState()) { case START_STATE: // No work done.. no commit/rollback needed. setStateFinished(); return XAResource.XA_RDONLY; case IN_USE_STATE: // We would record prepare here. doPrePrepare(); setState(Transaction.PREPARED_STATE); transactionStore.prepare(getTransactionId()); return XAResource.XA_OK; default: illegalStateTransition("prepare"); return XAResource.XA_RDONLY; } }
@Override public void commit(boolean onePhase) throws XAException, IOException { if (LOG.isDebugEnabled()) { LOG.debug("XA Transaction commit onePhase:" + onePhase + ", xid: " + xid); } switch (getState()) { case START_STATE: // 1 phase commit, no work done. checkForPreparedState(onePhase); setStateFinished(); break; case IN_USE_STATE: // 1 phase commit, work done. checkForPreparedState(onePhase); doPrePrepare(); setStateFinished(); storeCommit(getTransactionId(), false, preCommitTask, postCommitTask); break; case PREPARED_STATE: // 2 phase commit, work done. // We would record commit here. storeCommit(getTransactionId(), true, preCommitTask, postCommitTask); setStateFinished(); break; default: illegalStateTransition("commit"); } }
@Override public int prepare() throws XAException, IOException { if (LOG.isDebugEnabled()) { LOG.debug("XA Transaction prepare: " + xid); } switch (getState()) { case START_STATE: // No work done.. no commit/rollback needed. setStateFinished(); return XAResource.XA_RDONLY; case IN_USE_STATE: // We would record prepare here. doPrePrepare(); setState(Transaction.PREPARED_STATE); transactionStore.prepare(getTransactionId()); return XAResource.XA_OK; default: illegalStateTransition("prepare"); return XAResource.XA_RDONLY; } }
@Override public int prepare() throws XAException, IOException { if (LOG.isDebugEnabled()) { LOG.debug("XA Transaction prepare: " + xid); } switch (getState()) { case START_STATE: // No work done.. no commit/rollback needed. setStateFinished(); return XAResource.XA_RDONLY; case IN_USE_STATE: // We would record prepare here. doPrePrepare(); setState(Transaction.PREPARED_STATE); transactionStore.prepare(getTransactionId()); return XAResource.XA_OK; default: illegalStateTransition("prepare"); return XAResource.XA_RDONLY; } }
@Override public int prepare() throws XAException, IOException { if (LOG.isDebugEnabled()) { LOG.debug("XA Transaction prepare: " + xid); } switch (getState()) { case START_STATE: // No work done.. no commit/rollback needed. setStateFinished(); return XAResource.XA_RDONLY; case IN_USE_STATE: // We would record prepare here. doPrePrepare(); setState(Transaction.PREPARED_STATE); transactionStore.prepare(getTransactionId()); return XAResource.XA_OK; default: illegalStateTransition("prepare"); return XAResource.XA_RDONLY; } }
@Override public int prepare() throws XAException, IOException { if (LOG.isDebugEnabled()) { LOG.debug("XA Transaction prepare: " + xid); } switch (getState()) { case START_STATE: // No work done.. no commit/rollback needed. setStateFinished(); return XAResource.XA_RDONLY; case IN_USE_STATE: // We would record prepare here. doPrePrepare(); setState(Transaction.PREPARED_STATE); transactionStore.prepare(getTransactionId()); return XAResource.XA_OK; default: illegalStateTransition("prepare"); return XAResource.XA_RDONLY; } }
@Override public void commit(boolean onePhase) throws XAException, IOException { if (LOG.isDebugEnabled()) { LOG.debug("XA Transaction commit onePhase:" + onePhase + ", xid: " + xid); } switch (getState()) { case START_STATE: // 1 phase commit, no work done. checkForPreparedState(onePhase); setStateFinished(); break; case IN_USE_STATE: // 1 phase commit, work done. checkForPreparedState(onePhase); doPrePrepare(); setStateFinished(); storeCommit(getTransactionId(), false, preCommitTask, postCommitTask); break; case PREPARED_STATE: // 2 phase commit, work done. // We would record commit here. setStateFinished(); storeCommit(getTransactionId(), true, preCommitTask, postCommitTask); break; default: illegalStateTransition("commit"); } }
@Override public void commit(boolean onePhase) throws XAException, IOException { if (LOG.isDebugEnabled()) { LOG.debug("XA Transaction commit onePhase:" + onePhase + ", xid: " + xid); } switch (getState()) { case START_STATE: // 1 phase commit, no work done. checkForPreparedState(onePhase); setStateFinished(); break; case IN_USE_STATE: // 1 phase commit, work done. checkForPreparedState(onePhase); doPrePrepare(); setStateFinished(); storeCommit(getTransactionId(), false, preCommitTask, postCommitTask); break; case PREPARED_STATE: // 2 phase commit, work done. // We would record commit here. setStateFinished(); storeCommit(getTransactionId(), true, preCommitTask, postCommitTask); break; default: illegalStateTransition("commit"); } }
@Override public void commit(boolean onePhase) throws XAException, IOException { if (LOG.isDebugEnabled()) { LOG.debug("XA Transaction commit: " + xid); } switch (getState()) { case START_STATE: // 1 phase commit, no work done. checkForPreparedState(onePhase); setStateFinished(); break; case IN_USE_STATE: // 1 phase commit, work done. checkForPreparedState(onePhase); doPrePrepare(); setStateFinished(); storeCommit(getTransactionId(), false, preCommitTask, postCommitTask); break; case PREPARED_STATE: // 2 phase commit, work done. // We would record commit here. setStateFinished(); storeCommit(getTransactionId(), true, preCommitTask, postCommitTask); break; default: illegalStateTransition("commit"); } }
@Override public void commit(boolean onePhase) throws XAException, IOException { if (LOG.isDebugEnabled()) { LOG.debug("XA Transaction commit onePhase:" + onePhase + ", xid: " + xid); } switch (getState()) { case START_STATE: // 1 phase commit, no work done. checkForPreparedState(onePhase); setStateFinished(); break; case IN_USE_STATE: // 1 phase commit, work done. checkForPreparedState(onePhase); doPrePrepare(); setStateFinished(); storeCommit(getTransactionId(), false, preCommitTask, postCommitTask); break; case PREPARED_STATE: // 2 phase commit, work done. // We would record commit here. setStateFinished(); storeCommit(getTransactionId(), true, preCommitTask, postCommitTask); break; default: illegalStateTransition("commit"); } }