/** * Iterate over the list of Synchronizations to complete all the methods to be performed before * completion */ boolean notifyBeforeCompletion() { Iterator iterator = syncList.iterator(); boolean result = true; while (iterator.hasNext()) { sync = ((Synchronization) iterator.next()); sync.beforeCompletion(); } return result; }
@Override public void notifySynchronizationsBeforeTransactionCompletion() { if ( synchronizations != null ) { for ( Synchronization synchronization : synchronizations ) { try { synchronization.beforeCompletion(); } catch ( Throwable t ) { LOG.synchronizationFailed( synchronization, t ); } } } }
@Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if ( "afterCompletion".equals( method.getName() ) ) { int status = args[2].equals(Boolean.TRUE) ? Status.STATUS_COMMITTED : Status.STATUS_UNKNOWN; synchronization.afterCompletion(status); } else if ( "beforeCompletion".equals( method.getName() ) ) { synchronization.beforeCompletion(); } else if ( "toString".equals( method.getName() ) ) { return synchronization.toString(); } return null; }
private void fireBeforeCompletion() { for (Synchronization synchronization : synchronizations) { synchronization.beforeCompletion(); } }
@Override public void beforeCompletion() { try { NamespaceContextSelector.pushCurrentSelector(selector); synchronization.beforeCompletion(); } finally { NamespaceContextSelector.popCurrentSelector(); } }
@Override public void notifySynchronizationsBeforeTransactionCompletion() { log.trace( "SynchronizationRegistryStandardImpl.notifySynchronizationsBeforeTransactionCompletion" ); if ( synchronizations != null ) { for ( Synchronization synchronization : synchronizations ) { try { synchronization.beforeCompletion(); } catch (Throwable t) { log.synchronizationFailed( synchronization, t ); throw new LocalSynchronizationException( "Exception calling user Synchronization (beforeCompletion): " + synchronization.getClass().getName(), t ); } } } }
+ preJcaSync); preJcaSync.beforeCompletion(); lastIndexProcessed = lastIndexProcessed + 1; + jcaSync); jcaSync.beforeCompletion(); lastIndexProcessed = lastIndexProcessed + 1;
public void beforeCompletion() { try { if (importBacking()) try { sync.beforeCompletion(); } finally { unimportBacking(); } else { performConsumer(Synchronization::beforeCompletion, sync); } } catch (SystemException e) { throw new SynchronizationException(e); } }
@Test public void jtaTransactionManagerWithExistingTransactionAndJtaSynchronization() throws Exception { UserTransaction ut = mock(UserTransaction.class); TransactionManager tm = mock(TransactionManager.class); MockJtaTransaction tx = new MockJtaTransaction(); given(ut.getStatus()).willReturn(Status.STATUS_ACTIVE); given(tm.getTransaction()).willReturn(tx); final TransactionSynchronization synch = mock(TransactionSynchronization.class); JtaTransactionManager ptm = newJtaTransactionManager(ut, tm); TransactionTemplate tt = new TransactionTemplate(ptm); assertFalse(TransactionSynchronizationManager.isSynchronizationActive()); tt.execute(new TransactionCallbackWithoutResult() { @Override protected void doInTransactionWithoutResult(TransactionStatus status) { assertTrue(TransactionSynchronizationManager.isSynchronizationActive()); TransactionSynchronizationManager.registerSynchronization(synch); status.setRollbackOnly(); } }); assertFalse(TransactionSynchronizationManager.isSynchronizationActive()); assertNotNull(tx.getSynchronization()); tx.getSynchronization().beforeCompletion(); tx.getSynchronization().afterCompletion(Status.STATUS_ROLLEDBACK); verify(ut).setRollbackOnly(); verify(synch).beforeCompletion(); verify(synch).afterCompletion(TransactionSynchronization.STATUS_ROLLED_BACK); }
/** * BeforeCompletion wrapper. Translates WAS proprietary call to a * javax.transaction.Synchronization call. */ public void beforeCompletion(int arg0, byte[] arg1) { if (_sync != null) { _sync.beforeCompletion(); } } }
public void beforeCompletion() { for (Synchronization sync : handlers) { sync.beforeCompletion(); } }
public void beforeCompletion() { if (this.beforeRequired) { try { this.delegate.beforeCompletion(); } catch (RuntimeException rex) { // ignore } finally { this.beforeRequired = false; } } }
/** * BeforeCompletion wrapper. Translates WAS proprietary call to a * javax.transaction.Synchronization call. */ public void beforeCompletion(int arg0, byte[] arg1) { if (_sync != null) { _sync.beforeCompletion(); } } }
private void doBeforeCompletion() { for (final Synchronization sync : new ArrayList<Synchronization>(registeredSynchronizations)) { sync.beforeCompletion(); } }
private void doBeforeCompletion() { for (Synchronization sync : new ArrayList<Synchronization>(registeredSynchronizations)) { sync.beforeCompletion(); } }
public void beforeCompletion() { for (int i = 0; i < interposedSynchronizations.size(); ++i) { final Synchronization sync = (Synchronization) interposedSynchronizations .get(i); sync.beforeCompletion(); } }
public void beforeCompletion() { for (int i = 0; i < interposedSynchronizations.size(); ++i) { final Synchronization sync = (Synchronization) interposedSynchronizations.get(i); sync.beforeCompletion(); } }
@Override public void doBeforeTransactionCompletion(SessionImplementor sessionImplementor) { try { synchronization.beforeCompletion(); } catch (Exception e) { throw new HibernateException( "Error while indexing in Hibernate Search (before transaction completion)", e ); } } }
@Override public void beforeCompletion () { this.sync.beforeCompletion (); resetForReuse(); LOGGER.logDebug("beforeCompletion() called on Synchronization: " + this.sync.toString()); }
private void beforeCompletion(Synchronization sync) { try { sync.beforeCompletion(); } catch (Throwable t) { logger.log(t); status = Status.STATUS_MARKED_ROLLBACK; endResources(XAResource.TMFAIL); rollbackResources(); } }