protected void commitTransaction(Object transaction) { if( transaction == USER_MANAGED_TRANSACTION ) { return; } TransactionManager txm = (TransactionManager) transaction; try { if( txm != null ) { // There's a tx running, close it. txm.commit(true); } } catch(Exception e) { logger.error("Unable to commit transaction: ", e); } }
protected void closeTansactionIfNeeded(TransactionManager jtaTm, boolean commit) { if (jtaTm != null) { if (commit) { jtaTm.commit(true); } else { jtaTm.rollback(true); } } }
protected <R> R call(Function<EntityManager, R> function) { boolean transactionOwner = false; try { transactionOwner = txm.begin(); EntityManager em = emf.createEntityManager(); R result = function.apply(em); txm.commit( transactionOwner ); em.close(); return result; } catch (Exception e) { txm.rollback(transactionOwner); throw new RuntimeException( "Exception when persisting error information", e); } }
public <T> T execute(Command<T> command) { boolean transactionOwner = false; boolean emOwner = false; T result = null; try { transactionOwner = txm.begin(); EntityManager em = getEntityManager(command); if (em == null) { em = emf.createEntityManager(); emOwner = true; } JpaPersistenceContext context = new JpaPersistenceContext(em); context.joinTransaction(); result = ((ExecutableCommand<T>)command).execute( context ); txm.commit( transactionOwner ); context.close(transactionOwner, emOwner); return result; } catch ( RuntimeException re ) { rollbackTransaction( re, transactionOwner ); throw re; } catch ( Exception t1 ) { rollbackTransaction( t1, transactionOwner ); throw new RuntimeException( "Wrapped exception see cause", t1 ); } }
txm.commit(transactionOwner); report.addEntry(Type.INFO, "Migration of process instance (" + migrationSpec.getProcessInstanceId() + ") completed successfully to process " + migrationSpec.getToProcessId()); report.setSuccessful(true);
tm.commit(owner);
tm.commit(owner);
txm.commit( transactionOwner );
this.registry.register(this); if (tm != null) { tm.commit(owner);
protected <R> R call(Function<EntityManager, R> function) { boolean transactionOwner = false; try { transactionOwner = txm.begin(); EntityManager em = emf.createEntityManager(); R result = function.apply(em); txm.commit( transactionOwner ); em.close(); return result; } catch (Exception e) { txm.rollback(transactionOwner); throw new RuntimeException( "Exception when persisting error information", e); } }
public <T> T execute(Command<T> command) { boolean transactionOwner = false; boolean emOwner = false; T result = null; try { transactionOwner = txm.begin(); EntityManager em = getEntityManager(command); if (em == null) { em = emf.createEntityManager(); emOwner = true; } JpaPersistenceContext context = new JpaPersistenceContext(em); context.joinTransaction(); result = ((ExecutableCommand<T>)command).execute( context ); txm.commit( transactionOwner ); context.close(transactionOwner, emOwner); return result; } catch ( RuntimeException re ) { rollbackTransaction( re, transactionOwner ); throw re; } catch ( Exception t1 ) { rollbackTransaction( t1, transactionOwner ); throw new RuntimeException( "Wrapped exception see cause", t1 ); } }
@Override public void destroy() { PersistenceContext persistenceContext = this.jpm.getApplicationScopedPersistenceContext(); boolean transactionOwner = false; try { transactionOwner = txm.begin(); persistenceContext.joinTransaction(); initExistingKnowledgeSession( this.sessionInfo.getId(), this.marshallingHelper.getKbase(), this.marshallingHelper.getConf(), persistenceContext ); persistenceContext.remove(this.sessionInfo); txm.commit( transactionOwner ); } catch ( RuntimeException re ) { rollbackTransaction( re, transactionOwner ); throw re; } catch ( Exception t1 ) { rollbackTransaction(t1, transactionOwner); throw new RuntimeException( "Wrapped exception see cause", t1 ); } }
persistenceContext ); registerUpdateSync(); txm.commit( transactionOwner ); } catch (SessionNotFoundException e){
txm.commit( transactionOwner );
this.sessionInfo = (SessionInfo) persistenceContext.persist( this.sessionInfo ); registerUpdateSync(); txm.commit( transactionOwner ); } catch ( RuntimeException re ) { rollbackTransaction( re,
tm.commit(owner);
tm.commit(owner);
txm.commit( transactionOwner );
this.registry.register(this); if (tm != null) { tm.commit(owner);