Package java.lang

Examples of java.lang.IllegalStateException


    }

    TransactionImple theTransaction = TransactionImple.getTransaction();

    if (theTransaction == null)
      throw new IllegalStateException(
          jtaLogger.logMesg
              .getString("com.arjuna.ats.internal.jta.transaction.arjunacore.nosuchtx"));

    theTransaction.setRollbackOnly();
  }
View Full Code Here


    else
    {
      if ((theTransaction.getStatus() != javax.transaction.Status.STATUS_NO_TRANSACTION)
          && !_supportSubtransactions)
      {
        throw new IllegalStateException(
            "BaseTransaction.checkTransactionState - "
                + jtaLogger.logMesg.getString("com.arjuna.ats.internal.jta.transaction.arjunacore.alreadyassociated"));
      }
    }
  }
View Full Code Here

        _theTransaction.end(true);
      }
      catch (org.omg.CosTransactions.WrongTransaction wt)
      {
        throw new IllegalStateException(
            jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.wrongstatetx"));
      }
      catch (org.omg.CosTransactions.NoTransaction e1)
      {
        throw new IllegalStateException(
            jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.notx"));
      }
      catch (org.omg.CosTransactions.HeuristicMixed e2)
      {
        throw new javax.transaction.HeuristicMixedException();
      }
      catch (org.omg.CosTransactions.HeuristicHazard e3)
      {
        throw new javax.transaction.HeuristicMixedException();
      }
      catch (TRANSACTION_ROLLEDBACK e4)
      {
        throw new RollbackException(e4.toString());
      }
      catch (org.omg.CORBA.NO_PERMISSION e5)
      {
        throw new SecurityException();
      }
      catch (INVALID_TRANSACTION e6)
      {
        throw new IllegalStateException(
            jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.invalidtx2"));
      }
      catch (org.omg.CORBA.SystemException e7)
      {
        throw new javax.transaction.SystemException();
      }
      finally
      {
        TransactionImple.removeTransaction(this);
      }
    }
    else
      throw new IllegalStateException(
          jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.inactivetx"));
  }
View Full Code Here

      {
        _theTransaction.abort();
      }
      catch (org.omg.CosTransactions.WrongTransaction e1)
      {
        throw new IllegalStateException(
            jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.wrongstatetx"));
      }
      catch (org.omg.CORBA.NO_PERMISSION e2)
      {
        throw new SecurityException();
      }
      catch (INVALID_TRANSACTION e3)
      {
        throw new IllegalStateException(
            jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.invalidtx2"));
      }
      catch (NoTransaction e4)
      {
        throw new IllegalStateException(
            jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.notx"));
      }
      catch (org.omg.CORBA.SystemException e5)
      {
        throw new javax.transaction.SystemException();
      }
      finally
      {
        TransactionImple.removeTransaction(this);
      }

      if (endSuspendedFailed)
        throw new IllegalStateException(
            jtaLogger.logMesg.getString("com.arjuna.ats.internal.jta.transaction.jts.endsuspendfailed2"));
    }
    else
      throw new IllegalStateException(
          jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.inactivetx"));
  }
View Full Code Here

      {
        _theTransaction.rollbackOnly();
      }
      catch (org.omg.CosTransactions.NoTransaction e3)
      {
        throw new IllegalStateException(
            jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.notx"));
      }
      catch (org.omg.CORBA.SystemException e4)
      {
        throw new javax.transaction.SystemException();
      }
    }
    else
      throw new IllegalStateException(
          jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.inactivetx"));
  }
View Full Code Here

      {
        throw new javax.transaction.RollbackException(e2.toString());
      }
      catch (org.omg.CosTransactions.Inactive e3)
      {
        throw new IllegalStateException(
            jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.inactivetx"));
      }
      catch (org.omg.CosTransactions.SynchronizationUnavailable e4)
      {
        throw new IllegalStateException(
            jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.syncerror"));
      }
      catch (INVALID_TRANSACTION e5)
      {
        throw new IllegalStateException(
            jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.invalidtx2"));
      }
      catch (org.omg.CORBA.SystemException e6)
      {
        throw new javax.transaction.SystemException();
      }
    }
    else
      throw new IllegalStateException(
          jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.inactivetx"));
  }
View Full Code Here

      throw new RollbackException("TransactionImple.enlistResource - "
                    + jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.markedrollback"));
    case javax.transaction.Status.STATUS_ACTIVE:
      break;
    default:
      throw new IllegalStateException(
          jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.inactivetx"));
    }

    XAModifier theModifier = null;

    if (params != null)
    {
      if (params.length >= XAMODIFIER + 1)
      {
        if (params[XAMODIFIER] instanceof XAModifier)
        {
          theModifier = (XAModifier) params[XAMODIFIER];
        }
      }
    }

    try
    {
      /*
       * For each transaction we maintain a list of resources registered
       * with it. Each element on this list also contains a list of
       * threads which have registered this resource, and what their XID
       * was for that registration.
       */

      TxInfo info = null;

      /*
       * Have we seen this specific resource instance before? Do this
       * trawl first before checking the RM instance later. Saves time.
       */

      try
      {
        synchronized (this)
        {
          info = (TxInfo) _resources.get(xaRes);

          if (info == null)
          {
            /*
             * Null info means it's not in the main resources list,
             * but may be in the duplicates.
             */

            info = (TxInfo) _duplicateResources.get(xaRes);
          }
        }

        if (info != null)
        {
          switch (info.getState())
          {
          case TxInfo.ASSOCIATION_SUSPENDED:
          {
            /*
             * Have seen resource before, so do a resume. The
             * Resource instance will still be registered with the
             * transaction though.
             */

            xaRes.start(info.xid(), XAResource.TMRESUME);

            info.setState(TxInfo.ASSOCIATED);

            synchronized (this)
            {
              _suspendCount--;
            }

            return true; // already registered resource with this
            // transaction!
          }
          case TxInfo.ASSOCIATED:
          {
            /*
             * Already active on this transaction.
             */

            return true;
          }
          case TxInfo.NOT_ASSOCIATED:
          {
            /*
             * Resource was associated, but was presumably delisted.
             */
            xaRes.start(info.xid(), XAResource.TMJOIN);

            info.setState(TxInfo.ASSOCIATED);

            return true;
          }
          default:
          {
            // Note: this exception will be caught by our catch
            // block
            throw new IllegalStateException(
                "TransactionImple.enlistResource - "
                    + jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.illegalstate")
                    + info.getState());
          }
          }
View Full Code Here

    case javax.transaction.Status.STATUS_ACTIVE:
      break;
    case javax.transaction.Status.STATUS_MARKED_ROLLBACK:
      break;
    default:
      throw new IllegalStateException(
          jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.inactivetx"));
    }

    TxInfo info = null;

    try
    {
      synchronized (this)
      {
        info = (TxInfo) _resources.get(xaRes);

        if (info == null)
          info = (TxInfo) _duplicateResources.get(xaRes);
      }

      if (info == null)
      {
        if (jtaLogger.loggerI18N.isWarnEnabled())
        {
          jtaLogger.loggerI18N.warn("com.arjuna.ats.internal.jta.transaction.jts.unknownres", new Object[]
          { "TransactionImple.delistResource" });
        }

        return false;
      }
      else
      {
        boolean optimizedRollback = false;

        try
        {
          /*
           * If we know the transaction is going to rollback, then we
           * can try to rollback the RM now. Just an optimisation.
           */

          if (status == javax.transaction.Status.STATUS_MARKED_ROLLBACK)
          {
            if (XAUtils.canOptimizeDelist(xaRes))
            {
              xaRes.end(info.xid(), XAResource.TMFAIL);
              xaRes.rollback(info.xid());

              info.setState(TxInfo.OPTIMIZED_ROLLBACK);

              optimizedRollback = true;
            }
          }
        }
        catch (Exception e)
        {
          // failed, so try again when transaction does rollback
        }

        switch (info.getState())
        {
        case TxInfo.ASSOCIATED:
        {
          if ((flags & XAResource.TMSUCCESS) != 0)
          {
            xaRes.end(info.xid(), XAResource.TMSUCCESS);
            info.setState(TxInfo.NOT_ASSOCIATED);
          }
          else
          {
            if ((flags & XAResource.TMSUSPEND) != 0)
            {
              xaRes.end(info.xid(), XAResource.TMSUSPEND);
              info.setState(TxInfo.ASSOCIATION_SUSPENDED);

              synchronized (this)
              {
                _suspendCount++;
              }
            }
            else
            {
              xaRes.end(info.xid(), XAResource.TMFAIL);
              info.setState(TxInfo.FAILED);
            }
          }
        }
          break;
        case TxInfo.ASSOCIATION_SUSPENDED:
        {
          if ((flags & XAResource.TMSUCCESS) != 0)
          {
            // Oracle barfs if we don't resume first, despite what
            // XA says!

            if (XAUtils.mustEndSuspendedRMs(xaRes))
              xaRes.start(info.xid(), XAResource.TMRESUME);

            xaRes.end(info.xid(), XAResource.TMSUCCESS);
            info.setState(TxInfo.NOT_ASSOCIATED);

            synchronized (this)
            {
              _suspendCount--;
            }
          }
          else
          {
            if ((flags & XAResource.TMSUSPEND) != 0)
            {
              // Note: this exception will be caught by our catch
              // block

              throw new IllegalStateException(
                  "TransactionImple.delistResource - "
                      + jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.ressusp"));
            }
            else
            {
              xaRes.end(info.xid(), XAResource.TMFAIL);
              info.setState(TxInfo.FAILED);

              synchronized (this)
              {
                _suspendCount--;
              }
            }
          }
        }
          break;
        default:
          if (!optimizedRollback)
            throw new IllegalStateException(
                "TransactionImple.delistResource - "
                    + jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.illegalstate")
                    + info.getState());
        }

View Full Code Here

      {
        _theTransaction.commit(true);
      }
      catch (org.omg.CosTransactions.WrongTransaction wt)
      {
        throw new IllegalStateException(
            jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.wrongstatetx"));
      }
      catch (org.omg.CosTransactions.NoTransaction e1)
      {
        throw new IllegalStateException(
            jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.notx"));
      }
      catch (org.omg.CosTransactions.HeuristicMixed e2)
      {
        throw new javax.transaction.HeuristicMixedException();
      }
      catch (org.omg.CosTransactions.HeuristicHazard e3)
      {
        throw new javax.transaction.HeuristicMixedException();
      }
      catch (TRANSACTION_ROLLEDBACK e4)
      {
        throw new RollbackException(e4.toString());
      }
      catch (org.omg.CORBA.NO_PERMISSION e5)
      {
        throw new SecurityException();
      }
      catch (INVALID_TRANSACTION e6)
      {
        throw new IllegalStateException(
            jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.invalidtx2"));
      }
      catch (org.omg.CORBA.SystemException e7)
      {
        throw new javax.transaction.SystemException();
      }
      finally
      {
        TransactionImple.removeTransaction(this);
      }
    }
    else
      throw new IllegalStateException(
          jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.inactivetx"));
  }
View Full Code Here

      {
        _theTransaction.rollback();
      }
      catch (org.omg.CosTransactions.WrongTransaction e1)
      {
        throw new IllegalStateException(
            jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.wrongstatetx"));
      }
      catch (org.omg.CORBA.NO_PERMISSION e2)
      {
        throw new SecurityException();
      }
      catch (INVALID_TRANSACTION e3)
      {
        throw new IllegalStateException(
            jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.invalidtx2"));
      }
      catch (NoTransaction e4)
      {
        throw new IllegalStateException(
            jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.notx"));
      }
      catch (org.omg.CORBA.SystemException e5)
      {
        throw new javax.transaction.SystemException();
      }
      finally
      {
        TransactionImple.removeTransaction(this);
      }
    }
    else
      throw new IllegalStateException(
          jtaLogger.loggerI18N.getString("com.arjuna.ats.internal.jta.transaction.jts.inactivetx"));
  }
View Full Code Here

TOP

Related Classes of java.lang.IllegalStateException

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.