Package net.jini.core.transaction.server

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


  typeCheck(rep);
  rep.pickID();

  if (opsLogger.isLoggable(Level.FINER) && (tr != null)) {
      ServerTransaction str = serverTransaction(tr);
      opsLogger.log(Level.FINER, "OutriggerServerImpl: write under " +
                "transaction [mgr:{0} id:{1}]",
    new Object[]{str.mgr, new Long(str.id)});
  }
View Full Code Here


      typeCheck(entries[i]);
      entries[i].pickID();
  }

  if (opsLogger.isLoggable(Level.FINER) && (tr != null)) {
      ServerTransaction str = serverTransaction(tr);
      opsLogger.log(Level.FINER, "OutriggerServerImpl: write<multiple> " +
        "under transaction [mgr:{0} id:{1}]",
    new Object[]{str.mgr, new Long(str.id)});
  }
View Full Code Here

  final long currentOrdinal = operationJournal.currentOrdinal();

  // Register a watcher for this client
  tmpl = setupTmpl(tmpl);

        ServerTransaction str = serverTransaction(tr);
  Txn txn = enterTxn(tr);

  final Uuid cookie = UuidFactory.generate();
  final long eventID = nextID();
  final long now = System.currentTimeMillis();
View Full Code Here

  listener =
      (RemoteEventListener)listenerPreparer.prepareProxy(listener);
  final long currentOrdinal = operationJournal.currentOrdinal();

        ServerTransaction str = serverTransaction(tr);
  Txn txn = enterTxn(tr);

  for (int i=0; i<tmpls.length; i++) {
      typeCheck(tmpls[i]);
  }
View Full Code Here

  }

  checkLimit(limit);
  checkTimeout(timeout);

  ServerTransaction str = serverTransaction(tr);
  Txn txn = enterTxn(tr);

  /* Don't bother if transaction is not active,
   * synchronize so we get the most recent answer,
   * not because we need to make anything atomic.
View Full Code Here

  if (leaseTime < 1 && leaseTime != Lease.ANY) {
      throw logAndThrowIllegalArg(
     "leaseTime = " + leaseTime + ", must be postive or Lease.ANY");
  }

  ServerTransaction str = serverTransaction(tr);
  Txn txn = enterTxn(tr);

  /* Don't bother if transaction is not active,
   * synchronize so we get the most recent answer,
   * not because we need to make anything atomic.
View Full Code Here

  throws TransactionException, RemoteException
    {
  iteratorLogger.entering("OutriggerServerImpl", "contents");

  typeCheck(tmpl);
  ServerTransaction str = serverTransaction(tr);

  Txn txn = enterTxn(tr);

  /* Don't bother if transaction is not active,
   * synchronize so we get the most recent answer,
View Full Code Here

    {
  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

  /*
   * 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

    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

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.