/** * Called by TransactionManager in preparation for a transaction * that is known to abort. * * @param id the Transaction identifier * @param context transaction context * @return 0 [| NO_JOIN | READONLY) */ default int prepareForAbort(long id, Serializable context) { return prepare (id, context); } }
public void run() { switch (mode) { case PREPARE: rc = p.prepare(id, ctx); break; case PREPARE_FOR_ABORT: if (p instanceof AbortParticipant) rc = ((AbortParticipant)p).prepareForAbort (id, ctx); break; case COMMIT: if ((rc & NO_JOIN) == 0) p.commit (id, ctx); break; case ABORT: if ((rc & NO_JOIN) == 0) p.abort (id, ctx); break; } } public void join () {
protected int prepareForAbort (TransactionParticipant p, long id, Serializable context) { Chronometer c = new Chronometer(); try { if (p instanceof AbortParticipant) { setThreadName(id, "prepareForAbort", p); return ((AbortParticipant)p).prepareForAbort (id, context); } } catch (Throwable t) { getLog().warn ("PREPARE-FOR-ABORT: " + Long.toString (id), t); } finally { if (metrics != null) metrics.record(getName(p) + "-prepare-for-abort", c.elapsed()); } return ABORTED | NO_JOIN; } protected int prepare