forceDestroyBean(context); } finally { transactionManager.rollback(); if (transactionManager.isTimedOut()) { _logger.log(Level.WARNING, "ejb.tx_timeout", new Object[] { transactionManager.getTransaction(), ejbDescriptor.getName()}); transactionManager.rollback(); transactionManager.rollback(); } else { transactionManager.commit();
@Override protected void afterExecute(Runnable r, Throwable t) { super.afterExecute(r, t); try { JavaEETransactionManager tm = EjbContainerUtilImpl.getInstance().getTransactionManager(); if (tm.getTransaction() != null) { int st = tm.getStatus(); Logger logger = EjbContainerUtilImpl.getLogger(); logger.warning("NON-NULL TX IN AFTER_EXECUTE. TX STATUS: " + st); if (st == Status.STATUS_ROLLEDBACK || st == Status.STATUS_COMMITTED || st == Status.STATUS_UNKNOWN) { tm.clearThreadTx(); } else { tm.rollback(); } } } catch (Exception e) { e.printStackTrace(); } }
protected void destroyReadyStoreOnUndeploy() { if (readyStore == null) { return; } // destroy all EJB instances in readyStore synchronized ( readyStore ) { Iterator beans = readyStore.values(); while ( beans.hasNext() ) { EJBContextImpl ctx = (EJBContextImpl)beans.next(); transactionManager.componentDestroyed(ctx); } } readyStore.destroy(); readyStore = null; }
/** * delist the <code>ResourceHandle</code> from the transaction * * @param h <code>ResourceHandle</code> object * @param xaresFlag flag indicating transaction success. This can * be XAResource.TMSUCCESS or XAResource.TMFAIL * @exception <code>PoolingException</code> */ public void delistResource(ResourceHandle h, int xaresFlag) { try { JavaEETransactionManager tm = ConnectorRuntime.getRuntime().getTransactionManager(); Transaction tran = tm.getTransaction(); if (tran != null) { tm.delistResource(tran, h, xaresFlag); } } catch (SystemException ex) { _logger.log(Level.WARNING,"poolmgr.system_exception",ex); } catch (IllegalStateException ex) { // ignore } }
/** * Register the <code>ResourceHandle</code> in the transaction * * @param handle <code>ResourceHandle</code> object * @exception <code>PoolingException</code> If there is any error while * enlisting. */ public void enlistResource(ResourceHandle handle) throws PoolingException{ try { JavaEETransactionManager tm = ConnectorRuntime.getRuntime().getTransactionManager(); Transaction tran = tm.getTransaction(); if (tran != null) { tm.enlistResource(tran, handle); } } catch (Exception ex) { _logger.log(Level.SEVERE,"poolmgr.unexpected_exception",ex); throw new PoolingException(ex.toString(), ex); } }
preInvokeTxStatus.intValue() : transactionManager.getStatus(); inv.clientTx = transactionManager.suspend(); } catch (SystemException ex) { throw new EJBException(ex); isNullTx = transactionManager.isNullTransaction(); inv.clientTx = transactionManager.suspend(); transactionManager.resume(prevTx); transactionManager.enlistComponentResources(); inv.clientTx = transactionManager.suspend(); startNewTx(prevTx, inv); } else { // There is a client Tx inv.clientTx = transactionManager.getTransaction(); useClientTx(prevTx, inv); inv.clientTx = transactionManager.suspend();
public Transaction getTransaction() throws SystemException { return transactionManager.getTransaction(); }
transactionManager.begin(cmtTimeoutInSeconds); } else { transactionManager.begin(); Transaction tx = transactionManager.getTransaction(); if (! container.isSingleton) { context.setTransaction(tx); transactionManager.enlistComponentResources();
try { clientTx = transactionManager.getTransaction(); transactionManager.setRollbackOnly(); } catch ( Exception e ) { transactionManager.enlistComponentResources(); transactionManager.setRollbackOnly(); } catch ( Exception e ) { transactionManager.enlistComponentResources(); } catch (Exception ex) { try { transactionManager.setRollbackOnly(); } catch ( Exception e ) {
} finally { if (eventType == InstanceEvent.EventType.AFTER_DESTROY_EVENT) { tm.componentDestroyed(instance, inv); } else if (eventType == InstanceEvent.EventType.AFTER_FILTER_EVENT || eventType == InstanceEvent.EventType.AFTER_SERVICE_EVENT) { if (tm.getTransaction() != null) { tm.rollback(); tm.cleanTxnTimeout(); } catch (Exception ex) {} tm.componentDestroyed(instance, inv);
Transaction transaction = transactionManager.getCurrentTransaction(); if (transaction != null) { try { int status = transaction.getStatus(); if (status == Status.STATUS_ACTIVE) { transactionManager.commit(); } else if (status == Status.STATUS_MARKED_ROLLBACK) { transactionManager.rollback(); transactionManager.clearThreadTx();
public int getStatus() throws SystemException { return transactionManager.getStatus(); }
if ( !isSystemUncheckedException(exception) ) { if( isAppExceptionRequiringRollback(exception) ) { transactionManager.rollback(); } else { transactionManager.suspend(); forceDestroyBean(context); } finally { transactionManager.rollback(); forceDestroyBean(context); } finally { transactionManager.rollback(); forceDestroyBean(context); } finally { transactionManager.rollback(); forceDestroyBean(context); } finally { transactionManager.rollback();
if ((tran = tm.getTransaction()) != null) { inv.setTransaction(tran); tm.enlistComponentResources();
tran = tm.getTransaction(); } catch( Exception e ) { tran = null; tm.registerComponentResource(handle); tm.enlistResource(tran, handle); } catch (Exception ex) { if(_logger.isLoggable(Level.FINE)) { _logger.fine("Attempting to unregister component resource"); tm.unregisterComponentResource(handle);
tran = tm.getTransaction(); } catch (Exception e) { tran = null; tm.unregisterComponentResource(resource); tm.delistResource(tran, resource, xaresFlag);
tran = tm.getTransaction(); if ( tran == null ) { if (_logger.isLoggable(Level.FINE)) { Object comp = inv.getInstance(); List l = tm.getResourceList( comp, inv ); tm.enlistResource( tran, h );
/** * PreInvoke Transaction configuration for Servlet Container. * BaseContainer.preInvokeTx() handles all this for CMT EJB. * * Compensate that JavaEEInstanceListener.handleBeforeEvent( * BEFORE_SERVICE_EVENT) * gets called before WSIT WSTX Service pipe associates a JTA txn with * incoming thread. * * Precondition: assumes JTA transaction already associated with current * thread. */ public void preInvokeTx(boolean checkServletInvocation) { final ComponentInvocation inv = invocationManager.getCurrentInvocation(); if (inv != null && (!checkServletInvocation || inv.getInvocationType() == ComponentInvocation.ComponentInvocationType.SERVLET_INVOCATION)){ try { // Required side effect: note that // enlistComponentResources calls // ComponentInvocation.setTransaction(currentJTATxn). // If this is not correctly set, managed XAResource connections // are not auto enlisted when they are created. transactionManager.enlistComponentResources(); } catch (java.rmi.RemoteException re) { throw new IllegalStateException(re); } } }
public void rollback() throws IllegalStateException, SecurityException, SystemException { transactionManager.rollback(); }