public void rollback(boolean transactionOwner) { try { if ( transactionOwner ) { this.ptm.rollback( currentTransaction ); currentTransaction = null; } } catch ( Exception e ) { logger.warn( "Unable to rollback transaction", e ); throw new RuntimeException( "Unable to rollback transaction", e ); } }
public void rollback(boolean transactionOwner) { try { if ( transactionOwner ) { this.ptm.rollback( currentTransaction ); currentTransaction = null; } } catch ( Exception e ) { logger.warn( "Unable to rollback transaction", e ); throw new RuntimeException( "Unable to rollback transaction", e ); } }
public void rollback(boolean transactionOwner) { try { if ( transactionOwner ) { this.ptm.rollback( currentTransaction ); currentTransaction = null; } } catch ( Exception e ) { logger.warn( "Unable to rollback transaction", e ); throw new RuntimeException( "Unable to rollback transaction", e ); } }
public void rollback(boolean transactionOwner) { if (nestedTransactions || transactionOwner) { try { this.ptm.rollback(currentTransaction.pop()); } catch (Exception e) { logger.warn("Unable to rollback transaction", e); throw new RuntimeException("Unable to rollback transaction", e); } } }
public void rollback(boolean transactionOwner) { if ( nestedTransactions || transactionOwner ) { try { this.ptm.rollback( currentTransaction.pop() ); } catch ( Exception e ) { logger.warn( "Unable to rollback transaction", e ); throw new RuntimeException( "Unable to rollback transaction", e ); } } }
public void rollback(boolean transactionOwner) { if ( nestedTransactions || transactionOwner ) { try { this.ptm.rollback( currentTransaction.pop() ); } catch ( Exception e ) { logger.warn( "Unable to rollback transaction", e ); throw new RuntimeException( "Unable to rollback transaction", e ); } } }
public void rollback(boolean transactionOwner) { if ( nestedTransactions || transactionOwner ) { try { this.ptm.rollback( currentTransaction.pop() ); } catch ( Exception e ) { logger.warn( "Unable to rollback transaction", e ); throw new RuntimeException( "Unable to rollback transaction", e ); } } }
public void rollback(boolean transactionOwner) { if (nestedTransactions || transactionOwner) { try { this.ptm.rollback(currentTransaction.pop()); } catch (Exception e) { logger.warn("Unable to rollback transaction", e); throw new RuntimeException("Unable to rollback transaction", e); } } }
public void rollback(boolean transactionOwner) { try { if (transactionOwner) { this.ptm.rollback(currentTransaction); currentTransaction = null; if (TransactionSynchronizationManager.hasResource(KieSpringTransactionManager.RESOURCE_CONTAINER)) { TransactionSynchronizationManager.unbindResource(KieSpringTransactionManager.RESOURCE_CONTAINER); } } } catch (Exception e) { logger.warn("Unable to rollback transaction", e); throw new RuntimeException("Unable to rollback transaction", e); } }
public void rollback(boolean transactionOwner) { try { if (transactionOwner) { this.ptm.rollback(currentTransaction); currentTransaction = null; if (TransactionSynchronizationManager.hasResource(KieSpringTransactionManager.RESOURCE_CONTAINER)) { TransactionSynchronizationManager.unbindResource(KieSpringTransactionManager.RESOURCE_CONTAINER); } } } catch (Exception e) { logger.warn("Unable to rollback transaction", e); throw new RuntimeException("Unable to rollback transaction", e); } }
@Override public <T> T execute(Command<T> command) { TransactionStatus status = transactionManager.getTransaction(defTransDefinition); try { T result = super.execute(command); transactionManager.commit(status); return result; } catch (Throwable e) { transactionManager.rollback(status); throw new RuntimeException(e); } }
@Override public <T> T execute(Command<T> command) { TransactionStatus status = transactionManager.getTransaction(defTransDefinition); try { T result = super.execute(command); transactionManager.commit(status); return result; } catch (Throwable e) { transactionManager.rollback(status); throw new RuntimeException(e); } }
@Test public void testSimpleTaskInvocationWithRollback() throws Exception{ AbstractPlatformTransactionManager transactionManager = getTransactionManager(); RuntimeManager manager = getManager(); RuntimeEngine engine = getEngine(); KieSession ksession = getKieSession(); AuditLogService logService = getLogService(); DefaultTransactionDefinition def = new DefaultTransactionDefinition(); TransactionStatus status = transactionManager.getTransaction(def); ProcessInstance processInstance = ksession.startProcess(SAMPLE_HELLO_PROCESS_ID); long processInstanceId = processInstance.getId(); transactionManager.rollback(status); processInstance = ksession.getProcessInstance(processInstanceId); assertNull("Process instance not rolled back", processInstance); System.out.println("Process instance rolled back"); List<TaskSummary> tasks = getTaskService().getTasksAssignedAsPotentialOwner(USER_JOHN, "en-UK"); System.out.println("Found " + tasks.size() + " task(s) for user '"+USER_JOHN+"'"); assertEquals(0, tasks.size()); ProcessInstanceLog log = logService.findProcessInstance(processInstanceId); assertNull(log); manager.disposeRuntimeEngine(engine); } }
@Test public void testSimpleTaskInvocationWithRollback() throws Exception{ AbstractPlatformTransactionManager transactionManager = getTransactionManager(); RuntimeManager manager = getManager(); RuntimeEngine engine = getEngine(); KieSession ksession = getKieSession(); AuditLogService logService = getLogService(); DefaultTransactionDefinition def = new DefaultTransactionDefinition(); TransactionStatus status = transactionManager.getTransaction(def); ProcessInstance processInstance = ksession.startProcess(SAMPLE_HELLO_PROCESS_ID); long processInstanceId = processInstance.getId(); transactionManager.rollback(status); processInstance = ksession.getProcessInstance(processInstanceId); assertNull("Process instance not rolled back", processInstance); System.out.println("Process instance rolled back"); List<TaskSummary> tasks = getTaskService().getTasksAssignedAsPotentialOwner(USER_JOHN, "en-UK"); System.out.println("Found " + tasks.size() + " task(s) for user '"+USER_JOHN+"'"); assertEquals(0, tasks.size()); ProcessInstanceLog log = logService.findProcessInstance(processInstanceId); assertNull(log); manager.disposeRuntimeEngine(engine); } }