Package net.jini.core.transaction.server

Examples of net.jini.core.transaction.server.ServerTransaction


    {
  txnLogger.entering("OutriggerServerImpl", "enterTxn");
  if (baseTr == null)
      return null;

  ServerTransaction tr = serverTransaction(baseTr);
  if (tr.isNested()) {
      final String msg = "subtransactions not supported";
      final CannotNestException cne = new CannotNestException(msg);
      txnLogger.log(Levels.FAILED, msg, cne);
      throw cne;
  }
   

  Txn txn = null;
  try {
      txn = txnTable.get(tr.mgr, tr.id);
  } catch (IOException e) {
  } catch (ClassNotFoundException e) {
  } catch (SecurityException e) {
      /* ignore all of these exceptions. These all indicate
       * that there is at least one broken Txn with the same
       * id as baseTr. Either these Txns are not associated
       * with baseTr, in which case joining baseTr is fine, or
       * one of them is associated with baseTr, in which case
       * baseTr must be not be active (because only inactive
       * Txn objects can be broken) and the join bellow will fail
       */
  }

  /*
   * If we find the txn with the probe, we're all done. Just return.
   * Otherwise, we need to join the transaction. Of course, there
   * is a race condition here. While we are attempting to join,
   * others might be attempting to join also. We are careful
   * to ensure that only one of the racing threads is able to
   * update our internal data structures with our internal
   * representation of this transaction.
   * NB: There are better ways of doing this which could ensure
   *     we never make an unnecessary remote call that we may
   *     want to explore later.
   */
  if (txn == null) {
      final TransactionManager mgr =
    (TransactionManager)
        transactionManagerPreparer.prepareProxy(tr.mgr);
      tr = new ServerTransaction(mgr, tr.id);
      tr.join(participantProxy, crashCount);
      txn = txnTable.put(tr);
        }

        return txn;
    }
View Full Code Here


          "uuid must be non-null");

  this.threadpool = threadpool;
  this.wm = wm;
  this.logmgr = logmgr ;
  str = new ServerTransaction(mgr, id);
  this.settler = settler;
  this.uuid = uuid;

  trstate = ACTIVE;  //this is implied since ACTIVE is initial state
  // Expires is set after object is created when the associated
View Full Code Here

    Txn match = null;
    Throwable t = null; // The first throwable we get, if any
    final List fixed = new java.util.LinkedList(); // fixed Txns
    for (int i = 0; i < brokenTxnsForId.length; i++) {
      try {
        final ServerTransaction st = brokenTxnsForId[i]
            .getTransaction(proxyPreparer);

        /*
         * We fixed a Txn, remember so we can move it to txns.
         */
 
View Full Code Here

   * @param txn
   *            the <code>Txn</code> being recovered.
   */
  void recover(Txn txn) {
    // Try to get the transaction
    ServerTransaction st = null;
    try {
      st = txn.getTransaction(proxyPreparer);
    } catch (Throwable t) {
      // log, but otherwise ignore
      try {
View Full Code Here

  TransactionManager[] mbs = getTransactionManagers(2);
  TransactionManager txnmgr1 = mbs[0];
  TransactionManager txnmgr2 = mbs[1];

  Created txn1 = getCreated(txnmgr1, DURATION);
  ServerTransaction st1 = new ServerTransaction(txnmgr1, txn1.id);
  Created txn2 = getCreated(txnmgr2, DURATION);
  ServerTransaction st2 = new ServerTransaction(txnmgr2, txn2.id);

        logger.log(Level.INFO, "ServerTransaction #1: " + st1);
        logger.log(Level.INFO, "ServerTransaction #2: " + st2);
    }
View Full Code Here

  TransactionManager txnmgr1 = mbs[0];
  TransactionManager txnmgr2 = mbs[1];
  NestableTransactionManager ntxnmgr =
      new NoOpNestableTransactionManager();

        ServerTransaction st1_1 = new ServerTransaction(txnmgr1, 1L);
        ServerTransaction st1_2 = new ServerTransaction(txnmgr1, 2L);
        ServerTransaction st2_1 = new ServerTransaction(txnmgr2, 1L);
        ServerTransaction st2_2 = new ServerTransaction(txnmgr2, 2L);
        ServerTransaction st1_1_dup;
        NestableServerTransaction nst1_1 =
      new NestableServerTransaction(ntxnmgr, 1L, null);

 
        ServerTransaction st1_5 =
      new ServerTransaction(ntxnmgr, 5L);
        NestableServerTransaction nst1_5 =
      new NestableServerTransaction(ntxnmgr, 5L, nst1_1);

        // Get duplicate references
  MarshalledObject marshObj11 = new MarshalledObject(st1_1);
View Full Code Here

  /*
   * Now we know (a) the transaction itself is alive, and (b) some
   * lease still cares.  Make sure it's still active as far as the
   * it knows, and if it is, then ask the manager about it.
   */
  ServerTransaction tr;
  try {
      /* This may fix a broken Txn, if it does it won't get moved
       * from the broken to the unbroken list. It will get
       * moved eventually, but it does seem unfortunate it does
       * not happen immediately
       */
      tr = txn.getTransaction(
    monitor.space().getRecoveredTransactionManagerPreparer());
  } catch (RemoteException e) {
      final int cat = ThrowableConstants.retryable(e);

      if (cat == ThrowableConstants.BAD_INVOCATION ||
    cat == ThrowableConstants.BAD_OBJECT)
      {
    // Not likely to get better, give up
    logUnpackingFailure("definite exception", Level.INFO,
            true, e);           
    return true;
      } else if (cat == ThrowableConstants.INDEFINITE) {
    // try, try, again
    logUnpackingFailure("indefinite exception", Levels.FAILED,
            false, e);           
    mustQuery = true;
    return false;
      } else if (cat == ThrowableConstants.UNCATEGORIZED) {
    // Same as above but log differently.
    mustQuery = true;
    logUnpackingFailure("uncategorized exception", Level.INFO,
            false, e);           
    return false;
      } else {
    logger.log(Level.WARNING, "ThrowableConstants.retryable " +
         "returned out of range value, " + cat,
         new AssertionError(e));
    return false;
      }
  } catch (IOException e) {
      // Not likely to get better
      logUnpackingFailure("IOException", Level.INFO, true, e);
      return true;
  } catch (RuntimeException e) {
      // Not likely to get better
      logUnpackingFailure("RuntimeException", Level.INFO, true, e);
      return true;
  } catch (ClassNotFoundException e) {
      // codebase probably down, keep trying
      logUnpackingFailure("ClassNotFoundException", Levels.FAILED,
        false, e);
      mustQuery = true;
      return false;
  }

  if (logger.isLoggable(Level.FINEST))
      logger.log(Level.FINEST, "{0} tr = {1}", new Object[]{this, tr});

  int trState;
  try {
      trState = tr.getState();
  } catch (TransactionException e) {
      if (logger.isLoggable(Level.INFO))
    logger.log(Level.INFO, "Got TransactionException when " +
        "calling getState on " + tr + ", dropping transaction " +
        tr.id, e);
View Full Code Here

  throws IOException, ClassNotFoundException
    {
  if (tr == null) {
      final TransactionManager mgr =
    (TransactionManager)trm.get(preparer);
      tr = new ServerTransaction(mgr, trId);
  }
  return tr;
    }
View Full Code Here

TOP

Related Classes of net.jini.core.transaction.server.ServerTransaction

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.