Examples of DeadLockException


Examples of com.jayway.awaitility.core.DeadlockException

            // ... and fail if the exception is not thrown
            fail("ConditionTimeoutException expected.");

        } catch (ConditionTimeoutException e) {
            // check that the thrown exception has a DeadlockException attached to it
            DeadlockException cause = (DeadlockException) e.getCause();
            assertTrue(cause instanceof DeadlockException);
            assertEquals(2, cause.getThreadInfos().length);

        } finally {
            // interrupt both threads to clean up the JVM
            t1.interrupt();
            t2.interrupt();
View Full Code Here

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

Examples of com.sleepycat.je.DeadlockException

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

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

Examples of com.sleepycat.je.DeadlockException

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

Examples of com.sleepycat.je.DeadlockException

             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

Examples of com.sleepycat.je.DeadlockException


   @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

Examples of net.sf.ehcache.transaction.DeadLockException

                        try {
                            boolean locked = softLock.tryLock(timeBeforeTimeout());
                            if (!locked) {
                                LOG.debug("put: cache [{}] key [{}] soft locked in foreign transaction and not released before" +
                                        " current transaction timeout", cacheName, key);
                                throw new DeadLockException("deadlock detected in cache [" + cacheName + "] on key [" + key + "]" +
                                        " between current transaction [" + getCurrentTransactionContext().getTransactionId() + "]" +
                                        " and foreign transaction [" + softLock.getTransactionID() + "]");
                            }
                            softLock.clearTryLock();
                        } catch (InterruptedException ie) {
View Full Code Here

Examples of net.sf.ehcache.transaction.DeadLockException

                                    " die...", new Object[] {cacheName, key, timeBeforeTimeout()});
                            boolean locked = softLock.tryLock(timeBeforeTimeout());
                            if (!locked) {
                                LOG.debug("remove: cache [{}] key [{}] soft locked in foreign transaction and not released before" +
                                        " current transaction timeout", cacheName, key);
                                throw new DeadLockException("deadlock detected in cache [" + cacheName + "] on key [" + key + "] between" +
                                        " current transaction [" + getCurrentTransactionContext().getTransactionId() + "] and foreign" +
                                        " transaction [" + softLock.getTransactionID() + "]");
                            }
                            softLock.clearTryLock();
                        } catch (InterruptedException ie) {
View Full Code Here

Examples of net.sf.ehcache.transaction.DeadLockException

                    try {
                        boolean locked = softLock.tryLock(timeBeforeTimeout());
                        if (!locked) {
                            LOG.debug("putIfAbsent: cache [{}] key [{}] soft locked in foreign transaction and not released before" +
                                    " current transaction timeout", cacheName, key);
                            throw new DeadLockException("deadlock detected in cache [" + cacheName + "] on key [" + key + "] between" +
                                    " current transaction [" + getCurrentTransactionContext().getTransactionId() + "] and foreign" +
                                    " transaction [" + softLock.getTransactionID() + "]");
                        }
                        softLock.clearTryLock();
                    } catch (InterruptedException ie) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.