Package com.sleepycat.je

Examples of com.sleepycat.je.DeadlockException


     * enforced.
     */
    private LockConflictException newTxnTimeoutException(Locker locker,
                                                         String msg) {
        return oldLockExceptions ?
            new DeadlockException(locker, msg) :
            new TransactionTimeoutException(locker, msg);
    }
View Full Code Here


     * enforced.
     */
    private LockConflictException newLockTimeoutException(Locker locker,
                                                          String msg) {
        return oldLockExceptions ?
            new DeadlockException(locker, msg) :
            new LockTimeoutException(locker, msg);
    }
View Full Code Here

     * enforced.
     */
    private LockConflictException newTxnTimeoutException(Locker locker,
                                                         String msg) {
        return oldLockExceptions ?
            new DeadlockException(locker, msg) :
            new TransactionTimeoutException(locker, msg);
    }
View Full Code Here

     * enforced.
     */
    private LockConflictException newLockTimeoutException(Locker locker,
                                                          String msg) {
        return oldLockExceptions ?
            new DeadlockException(locker, msg) :
            new LockTimeoutException(locker, msg);
    }
View Full Code Here

             result.useLock,
             locker.getTxnTimeOut(),
             locker.getTxnStartMillis(),
             System.currentTimeMillis(),
             database);
                        throw new DeadlockException(errMsg);
                    }
                }

                boolean keepTime = (timeout > 0);
                long startTime = (keepTime ? System.currentTimeMillis() : 0);
                while (doWait) {
                    locker.setWaitingFor(result.useLock);
                    try {
                        locker.wait(timeout);
                    } catch (InterruptedException IE) {
      throw new RunRecoveryException(envImpl, IE);
                    }

                    boolean lockerTimedOut = locker.isTimedOut();
                    long now = System.currentTimeMillis();
                    boolean thisLockTimedOut =
                        (keepTime && (now - startTime > timeout));
                    boolean isRestart =
                        (result.lockGrant == LockGrantType.WAIT_RESTART);

                    /*
                     * Re-check for ownership of the lock following wait.  If
                     * we timed out and we don't have ownership then flush this
                     * lock from both the waiters and owners while under the
                     * lock table latch.  See SR 10103.
                     */
                    if (validateOwnership(nid, locker, type,
            lockerTimedOut ||
                                          thisLockTimedOut ||
                                          isRestart,
                                          memoryBudget)) {
                        break;
                    } else {

                        /*
                         * After a restart conflict the lock will not be held.
                         */
                        if (isRestart) {
                            throw rangeRestartException;
                        }

                        if (thisLockTimedOut) {
          locker.setOnlyAbortable();
                            String errMsg =
                                makeTimeoutMsg("Lock", locker, nodeId, type,
                                               result.lockGrant,
                                               result.useLock,
                                               timeout, startTime, now,
                 database);
                            throw new DeadlockException(errMsg);           
                        }

                        if (lockerTimedOut) {
          locker.setOnlyAbortable();
                            String errMsg =
                                makeTimeoutMsg("Transaction", locker,
                                               nodeId, type,
                                               result.lockGrant,
                                               result.useLock,
                                               locker.getTxnTimeOut(),
                                               locker.getTxnStartMillis(),
                                               now, database);
                            throw new DeadlockException(errMsg);
                        }
                    }
                }
            } finally {
    locker.setWaitingFor(null);
View Full Code Here


   @Test
   public void testMoreDeadlocks() throws Exception {
      worker.doWork();
      expectLastCall().andThrow(new DeadlockException());
      transaction.abort();
      expect(env.beginTransaction(null, null)).andReturn(transaction);
      worker.doWork();
      expectLastCall().andThrow(new DeadlockException());
      transaction.abort();
      expect(env.beginTransaction(null, null)).andReturn(transaction);
      worker.doWork();
      expectLastCall().andThrow(new DeadlockException());
      transaction.abort();
      replayAll();
      runner = new PreparableTransactionRunner(env, 2, null);
      try {
         runner.prepare(worker);
View Full Code Here

TOP

Related Classes of com.sleepycat.je.DeadlockException

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.