@Override public boolean isRollbackOnly() { return obtainUOWManager().getRollbackOnly(); }
@Override public void runUnderUOW(int type, boolean join, UOWAction action) throws UOWException { throw new UOWException(rex); } };
@Override public void runUnderUOW(int type, boolean join, UOWAction action) throws UOWActionException, UOWException { this.type = type; this.joined = join; try { this.status = UOW_STATUS_ACTIVE; action.run(); this.status = (this.rollbackOnly ? UOW_STATUS_ROLLEDBACK : UOW_STATUS_COMMITTED); } catch (Error | RuntimeException ex) { this.status = UOW_STATUS_ROLLEDBACK; throw ex; } catch (Exception ex) { this.status = UOW_STATUS_ROLLEDBACK; throw new UOWActionException(ex); } }
/** * <P> * RegistryManagedRuntime cannot suspend transactions, but WebSphere * provides an interface to submit work outside of the current tran. * </P> */ public void doNonTransactionalWork(Runnable runnable) throws RuntimeException, UnsupportedOperationException { try { UOWManagerFactory.getUOWManager().runUnderUOW( UOWManager.UOW_TYPE_LOCAL_TRANSACTION, false, new DelegatingUOWAction(runnable)); } catch(UOWActionException e ) { RuntimeException re = new RuntimeException(e.getMessage()); re.initCause(e); throw re; } catch(UOWException e ) { RuntimeException re = new RuntimeException(e.getMessage()); re.initCause(e); throw re; } }
boolean existingTx = (uowManager.getUOWStatus() != UOWSynchronizationRegistry.UOW_STATUS_NONE && uowManager.getUOWType() != UOWSynchronizationRegistry.UOW_TYPE_LOCAL_TRANSACTION); try { if (definition.getTimeout() > TransactionDefinition.TIMEOUT_DEFAULT) { uowManager.setUOWTimeout(uowType, definition.getTimeout()); uowManager.runUnderUOW(uowType, joinTx, action); if (debug) { logger.debug("Returned from WebSphere UOW action: type=" + uowType + ", join=" + joinTx);
/** * Obtain the WebSphere UOWManager from the default JNDI location * "java:comp/websphere/UOWManager". * @return the UOWManager object * @throws TransactionSystemException if the JNDI lookup failed * @see #setJndiTemplate */ protected UOWManager lookupDefaultUowManager() throws TransactionSystemException { try { logger.debug("Retrieving WebSphere UOWManager from default JNDI location [" + DEFAULT_UOW_MANAGER_NAME + "]"); return getJndiTemplate().lookup(DEFAULT_UOW_MANAGER_NAME, UOWManager.class); } catch (NamingException ex) { logger.debug("WebSphere UOWManager is not available at default JNDI location [" + DEFAULT_UOW_MANAGER_NAME + "] - falling back to UOWManagerFactory lookup"); return UOWManagerFactory.getUOWManager(); } }
logger.debug("Rolling back on application exception from transaction callback", ex); uowManager.setRollbackOnly(); logger.debug("Transaction callback has explicitly requested rollback"); uowManager.setRollbackOnly(); TransactionSynchronizationManager.clear(); if (!synchronizations.isEmpty()) { uowManager.registerInterposedSynchronization(new JtaAfterCompletionSynchronization(synchronizations));
/** * Registers the synchronizations as interposed JTA Synchronization on the UOWManager. */ @Override protected void doRegisterAfterCompletionWithJtaTransaction( JtaTransactionObject txObject, List<TransactionSynchronization> synchronizations) { obtainUOWManager().registerInterposedSynchronization(new JtaAfterCompletionSynchronization(synchronizations)); }
/** * <P> * RegistryManagedRuntime cannot suspend transactions, but WebSphere * provides an interface to submit work outside of the current tran. * </P> */ public void doNonTransactionalWork(Runnable runnable) throws RuntimeException, UnsupportedOperationException { try { UOWManagerFactory.getUOWManager().runUnderUOW( UOWManager.UOW_TYPE_LOCAL_TRANSACTION, false, new DelegatingUOWAction(runnable)); } catch(UOWActionException e ) { RuntimeException re = new RuntimeException(e.getMessage()); re.initCause(e); throw re; } catch(UOWException e ) { RuntimeException re = new RuntimeException(e.getMessage()); re.initCause(e); throw re; } }
boolean existingTx = (uowManager.getUOWStatus() != UOWSynchronizationRegistry.UOW_STATUS_NONE && uowManager.getUOWType() != UOWSynchronizationRegistry.UOW_TYPE_LOCAL_TRANSACTION); try { if (definition.getTimeout() > TransactionDefinition.TIMEOUT_DEFAULT) { uowManager.setUOWTimeout(uowType, definition.getTimeout()); uowManager.runUnderUOW(uowType, joinTx, action); if (debug) { logger.debug("Returned from WebSphere UOW action: type=" + uowType + ", join=" + joinTx);
/** * Obtain the WebSphere UOWManager from the default JNDI location * "java:comp/websphere/UOWManager". * @return the UOWManager object * @throws TransactionSystemException if the JNDI lookup failed * @see #setJndiTemplate */ protected UOWManager lookupDefaultUowManager() throws TransactionSystemException { try { logger.debug("Retrieving WebSphere UOWManager from default JNDI location [" + DEFAULT_UOW_MANAGER_NAME + "]"); return getJndiTemplate().lookup(DEFAULT_UOW_MANAGER_NAME, UOWManager.class); } catch (NamingException ex) { logger.debug("WebSphere UOWManager is not available at default JNDI location [" + DEFAULT_UOW_MANAGER_NAME + "] - falling back to UOWManagerFactory lookup"); return UOWManagerFactory.getUOWManager(); } }
logger.debug("Rolling back on application exception from transaction callback", ex); uowManager.setRollbackOnly(); logger.debug("Transaction callback has explicitly requested rollback"); uowManager.setRollbackOnly(); TransactionSynchronizationManager.clear(); if (!synchronizations.isEmpty()) { uowManager.registerInterposedSynchronization(new JtaAfterCompletionSynchronization(synchronizations));
@Override public boolean isRollbackOnly() { return obtainUOWManager().getRollbackOnly(); }
/** * Registers the synchronizations as interposed JTA Synchronization on the UOWManager. */ @Override protected void doRegisterAfterCompletionWithJtaTransaction( JtaTransactionObject txObject, List<TransactionSynchronization> synchronizations) { obtainUOWManager().registerInterposedSynchronization(new JtaAfterCompletionSynchronization(synchronizations)); }
/** * <P> * RegistryManagedRuntime cannot suspend transactions, but WebSphere * provides an interface to submit work outside of the current tran. * </P> */ public void doNonTransactionalWork(Runnable runnable) throws RuntimeException, UnsupportedOperationException { try { UOWManagerFactory.getUOWManager().runUnderUOW( UOWManager.UOW_TYPE_LOCAL_TRANSACTION, false, new DelegatingUOWAction(runnable)); } catch(UOWActionException e ) { RuntimeException re = new RuntimeException(e.getMessage()); re.initCause(e); throw re; } catch(UOWException e ) { RuntimeException re = new RuntimeException(e.getMessage()); re.initCause(e); throw re; } }
@Override public boolean isRollbackOnly() { return obtainUOWManager().getRollbackOnly(); }
/** * Registers the synchronizations as interposed JTA Synchronization on the UOWManager. */ @Override protected void doRegisterAfterCompletionWithJtaTransaction( JtaTransactionObject txObject, List<TransactionSynchronization> synchronizations) { obtainUOWManager().registerInterposedSynchronization(new JtaAfterCompletionSynchronization(synchronizations)); }
/** * <P> * RegistryManagedRuntime cannot suspend transactions, but WebSphere * provides an interface to submit work outside of the current tran. * </P> */ public void doNonTransactionalWork(Runnable runnable) throws RuntimeException, UnsupportedOperationException { try { UOWManagerFactory.getUOWManager().runUnderUOW( UOWManager.UOW_TYPE_LOCAL_TRANSACTION, false, new DelegatingUOWAction(runnable)); } catch(UOWActionException e ) { RuntimeException re = new RuntimeException(e.getMessage()); re.initCause(e); throw re; } catch(UOWException e ) { RuntimeException re = new RuntimeException(e.getMessage()); re.initCause(e); throw re; } }
@Override public boolean isRollbackOnly() { return obtainUOWManager().getRollbackOnly(); }
/** * Registers the synchronizations as interposed JTA Synchronization on the UOWManager. */ @Override protected void doRegisterAfterCompletionWithJtaTransaction( JtaTransactionObject txObject, List<TransactionSynchronization> synchronizations) { obtainUOWManager().registerInterposedSynchronization(new JtaAfterCompletionSynchronization(synchronizations)); }