Package com.caucho.transaction

Examples of com.caucho.transaction.TransactionImpl


    _transactionManager.begin();
    _isTransactionActive = true;
    boolean isOkay = false;

    try {
      TransactionImpl xa = (TransactionImpl) _transactionManager.getTransaction();
      xa.setUserTransaction(this);
   
      _poolItems.clear();
   
      // enlist "cached" connections
      int length = _resources.size();

      for (int i = 0; i < length; i++) {
  UserPoolItem userPoolItem = _resources.get(i);

  for (int j = _poolItems.size() - 1; j >= 0; j--) {
    ManagedPoolItem poolItem = _poolItems.get(j);

    if (poolItem.share(userPoolItem)) {
      break;
    }
  }

  ManagedPoolItem xaPoolItem = userPoolItem.getXAPoolItem();
  if (! _poolItems.contains(xaPoolItem))
    _poolItems.add(xaPoolItem);
      }

      for (int i = 0; i < _poolItems.size(); i++) {
  ManagedPoolItem poolItem = _poolItems.get(i);

  poolItem.enableLocalTransactionOptimization(_poolItems.size() == 1);

  try {
    xa.enlistResource(poolItem);
  } catch (Exception e) {
          String message = L.l("Failed to begin UserTransaction due to: {0}", e);
          log.log(Level.SEVERE, message, e);

    throw new SystemException(message);
View Full Code Here


   
    _poolItems.clear();

    if (isTransactionActive) {
      try {
  TransactionImpl xa = (TransactionImpl) _transactionManager.getTransaction();

  exn = new IllegalStateException(L.l("Transactions must have a commit() or rollback() in a finally block."));
     
  log.warning("Rolling back dangling transaction.  All transactions must have a commit() or rollback() in a finally block.");
     
View Full Code Here

   * Send the event notification.
   */
  @Override
  public void notify(T event)
  {
    TransactionImpl xa = _tm.getCurrent();
   
    try {
      if (xa != null && xa.isActive())
        xa.registerSynchronization(new AfterSuccess(event));
      else
        notifyImpl(event);
    } catch (Exception e) {
      log.log(Level.WARNING, e.toString(), e);
    }
View Full Code Here

   * Send the event notification.
   */
  @Override
  public void notify(T event)
  {
    TransactionImpl xa = _tm.getCurrent();
   
    try {
      if (xa != null && xa.isActive())
        xa.registerSynchronization(new AfterCompletion(event));
      else
        notifyImpl(event);
    } catch (Exception e) {
      log.log(Level.WARNING, e.toString(), e);
    }
View Full Code Here

   * Send the event notification.
   */
  @Override
  public void notify(T event)
  {
    TransactionImpl xa = _tm.getCurrent();
   
    try {
      if (xa != null && xa.isActive())
        xa.registerSynchronization(new AfterFailure(event));
      else
        notifyImpl(event);
    } catch (Exception e) {
      log.log(Level.WARNING, e.toString(), e);
    }
View Full Code Here

   * Send the event notification.
   */
  @Override
  public void notify(T event)
  {
    TransactionImpl xa = _tm.getCurrent();
   
    try {
      if (xa != null && xa.isActive())
        xa.registerSynchronization(new BeforeCompletion(event));
      else
        notifyImpl(event);
    } catch (Exception e) {
      log.log(Level.WARNING, e.toString(), e);
    }
View Full Code Here

TOP

Related Classes of com.caucho.transaction.TransactionImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.