/** * Start a transaction validation, the validation phase needs 3 phases: begin, commit * and release. The begin ensure the mutual exclusion of the current transaction. * * @see fr.dyade.aaa.util.Transaction#begin() */ public final synchronized void begin() throws IOException { while (phase != FREE) { try { wait(); } catch (InterruptedException exc) { } } // Change the transaction state. setPhase(RUN); }
/** * Start a transaction validation, the validation phase needs 3 phases: begin, commit * and release. The begin ensure the mutual exclusion of the current transaction. * * @see fr.dyade.aaa.util.Transaction#begin() */ public final synchronized void begin() throws IOException { while (phase != FREE) { try { wait(); } catch (InterruptedException exc) { } } // Change the transaction state. setPhase(RUN); }
/** * Release the mutual exclusion. * @see fr.dyade.aaa.util.Transaction#release() */ public synchronized void release() throws IOException { if ((phase != RUN) && (phase != COMMIT) && (phase != ROLLBACK)) throw new IllegalStateException("Can not release transaction: " + getPhaseInfo() + '.'); // Change the transaction state. setPhase(FREE); // wake-up an eventually user's thread in begin notify(); }
/** * Release the mutual exclusion. * @see fr.dyade.aaa.util.Transaction#release() */ public synchronized void release() throws IOException { if ((phase != RUN) && (phase != COMMIT) && (phase != ROLLBACK)) throw new IllegalStateException("Can not release transaction: " + getPhaseInfo() + '.'); // Change the transaction state. setPhase(FREE); // wake-up an eventually user's thread in begin notify(); } }