Package com.sun.sgs.app

Examples of com.sun.sgs.app.TransactionTimeoutException


       * If the transaction is not active on the server, then it may have
       * timed out.
       */
      long duration = System.currentTimeMillis() - txn.getCreationTime();
      if (duration > txn.getTimeout()) {
    e = new TransactionTimeoutException(
        operation + " failed: Transaction timed out after " +
        duration + " ms",
        e);
      }
  }
View Full Code Here


     */
    private void checkTimeout(Transaction txn) {
  long max = Math.min(txn.getTimeout(), maxTxnTimeout);
  long runningTime = System.currentTimeMillis() - txn.getCreationTime();
  if (runningTime > max) {
      throw new TransactionTimeoutException(
    "Transaction timed out: " + runningTime + " ms");
  }
    }
View Full Code Here

     */
    static RuntimeException convertException(
  Exception e, boolean convertTxnExceptions)
    {
  if (convertTxnExceptions && e instanceof LockNotGrantedException) {
      return new TransactionTimeoutException(
    "Transaction timed out: " + e.getMessage(), e);
  } else if (convertTxnExceptions && e instanceof DeadlockException) {
      return new TransactionConflictException(
    "Transaction conflict: " + e.getMessage(), e);
  } else if (e instanceof RunRecoveryException) {
      /*
       * It is tricky to clean up the data structures in this instance in
       * order to reopen the Berkeley DB databases, because it's hard to
       * know when they are no longer in use.  It's OK to catch this
       * Error and create a new environment instance, but this instance
       * is dead.  -tjb@sun.com (10/19/2006)
       */
      Error error = new Error(
    "Database requires recovery -- need to restart: " + e, e);
      logger.logThrow(Level.SEVERE, error, "Database requires recovery");
      throw error;
  } else if (e instanceof XAException) {
      int errorCode = ((XAException) e).errorCode;
      if (errorCode == XA_RBTIMEOUT) {
    throw new TransactionTimeoutException(
        "Transaction timed out: " + e.getMessage(), e);
      } else if (errorCode == XA_RBDEADLOCK) {
    throw new TransactionConflictException(
        "Transaction conflict: " + e.getMessage(), e);
      } else if (errorCode >= XA_RBBASE && errorCode <= XA_RBEND) {
View Full Code Here

   * Don't include DatabaseExceptions as the cause because, even though
   * that class implements Serializable, the Environment object
   * optionally contained within them is not.  -tjb@sun.com (01/19/2007)
   */
  if (convertTxnExceptions && e instanceof LockNotGrantedException) {
      return new TransactionTimeoutException(
    "Transaction timed out: " + e);
  } else if (convertTxnExceptions && e instanceof DeadlockException) {
      return new TransactionConflictException(
    "Transaction conflict: " + e);
  } else if (e instanceof RunRecoveryException) {
View Full Code Here

      } else if ((state.get() & PREPARED) != 0) {
    return;
      }
      long runningTime = System.currentTimeMillis() - getCreationTime();
      if (runningTime > getTimeout()) {
    throw new TransactionTimeoutException(
        "Transaction timed out: " + runningTime + " ms");
      }
  }
View Full Code Here

  default:
      throw new AssertionError();
  }
  long runningTime = System.currentTimeMillis() - getCreationTime();
  if (runningTime > getTimeout()) {
      TransactionTimeoutException exception =
    new TransactionTimeoutException(
        "transaction timed out: " + runningTime + " ms");
      abort(exception);
      throw exception;
  }
    }
View Full Code Here

    String conflictMsg = ", with conflicting transaction " +
        conflict.getConflictingTransaction();
    TransactionAbortedException exception;
    switch (conflict.getType()) {
    case TIMEOUT:
        exception = new TransactionTimeoutException(
      accessMsg + "Transaction timed out" + conflictMsg);
        break;
    case DENIED:
        exception = new TransactionConflictException(
      accessMsg + "Access denied" + conflictMsg);
View Full Code Here

        verifyMocks();
    }

    @Test
    public void testTimeoutResultAndRetryCountAboveBackoffThreshold() {
        setupTask(new TransactionTimeoutException("timed out"));
        // program the expected behavior of the task
        EasyMock.expect(task.getTryCount()).andStubReturn(
                NowOrLaterRetryPolicy.DEFAULT_RETRY_BACKOFF_THRESHOLD + 1);
        EasyMock.expect(task.getTimeout()).andStubReturn(100L);
        task.setTimeout(100L * 2);
 
View Full Code Here

        verifyMocks();
    }

    @Test
    public void testTimeoutResultAndTimeoutSetTooHigh() {
        setupTask(new TransactionTimeoutException("timed out"));
        // program the expected behavior of the task
        EasyMock.expect(task.getTryCount()).andStubReturn(
                NowOrLaterRetryPolicy.DEFAULT_RETRY_BACKOFF_THRESHOLD + 1);
        EasyMock.expect(task.getTimeout()).andStubReturn(
                (long) (Integer.MAX_VALUE / 2 + Integer.MAX_VALUE / 4));
View Full Code Here

   * Don't include DatabaseExceptions as the cause because, even though
   * that class implements Serializable, the Environment object
   * optionally contained within them is not.  -tjb@sun.com (01/19/2007)
   */
  if (convertTxnExceptions && e instanceof LockNotGrantedException) {
      return new TransactionTimeoutException(
    "Transaction timed out: " + e);
  } else if (convertTxnExceptions && e instanceof DeadlockException) {
      return new TransactionConflictException(
    "Transaction conflict: " + e);
  } else if (e instanceof RunRecoveryException) {
View Full Code Here

TOP

Related Classes of com.sun.sgs.app.TransactionTimeoutException

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.