private void checkpoint() { logger.trace("Checkpointing Transaction"); JvstmOJBTransaction transaction = getTransaction(); for (CommitListener listener : listeners) { listener.beforeCommit(transaction); } Transaction.checkpoint(); for (CommitListener listener : listeners) { listener.afterCommit(transaction); } TransactionSupport.currentFenixTransaction().setReadOnly(); logger.trace("Transaction is now read-only"); }
/** * @see javax.transaction.TransactionManager#rollback() */ @Override public void rollback() throws IllegalStateException, SecurityException, SystemException { Transaction toRollback = getTransaction(); if (toRollback == null) { throw new IllegalStateException(); } backendRollback(); for (CommitListener listener : listeners) { listener.afterCommit(toRollback); } }
@Override public void commit() throws RollbackException, HeuristicMixedException, HeuristicRollbackException, SystemException { logger.trace("Commit transaction"); pt.ist.fenixframework.Transaction tx = getTransaction(); try { for (CommitListener listener : listeners) { listener.beforeCommit(tx); } } catch (RuntimeException e) { /** * As specified in CommitListener.beforeCommit(), any unchecked * exception will cause the transaction to be rolled back. */ rollback(); throw new RollbackException(e.getMessage()); } try { EntityManager em = currentEntityManager.get(); em.flush(); delegateTxManager.commit(); em.close(); currentEntityManager.set(null); } finally { for (CommitListener listener : listeners) { listener.afterCommit(tx); } } }
@Override public void commit() throws RollbackException, HeuristicMixedException, HeuristicRollbackException, SystemException { logger.trace("Commit transaction"); pt.ist.fenixframework.Transaction tx = getTransaction(); try { for (CommitListener listener : listeners) { listener.beforeCommit(tx); } } catch (RuntimeException e) { /** * As specified in CommitListener.beforeCommit(), any unchecked * exception will cause the transaction to be rolled back. */ rollback(); throw new RollbackException(e.getMessage()); } try { delegateTxManager.commit(); } finally { for (CommitListener listener : listeners) { listener.afterCommit(tx); } } }
@Override public void commit() throws RollbackException, HeuristicMixedException, HeuristicRollbackException, SecurityException, IllegalStateException, SystemException { Transaction toCommit = getTransaction(); if (toCommit == null) { throw new IllegalStateException(); } try { for (CommitListener listener : listeners) { listener.beforeCommit(toCommit); } } catch (RuntimeException e) { /** * As specified in CommitListener.beforeCommit(), any unchecked * exception will cause the transaction to be rolled back. */ rollback(); throw new FenixRollbackException(e, e.getMessage()); } backendCommit(); for (CommitListener listener : listeners) { listener.afterCommit(toCommit); } }