Package com.sleepycat.je.txn

Examples of com.sleepycat.je.txn.Txn.lock()


         * We're reconstructing a prepared, but not
         * finished, transaction.  We know that there
         * was a write lock on this LN since it exists
         * in the log under this txnId.
         */
        preparedTxn.lock(ln.getNodeId(),
             LockType.WRITE,
             db);
        preparedTxn.setPrepared(true);
          }

View Full Code Here


           
            /*
       * Log an LN. If we're tracking LNs add it to the verification
       * list.
       */
            userTxn.lock
                (ln.getNodeId(), LockType.WRITE,
                 DbInternal.dbGetDatabaseImpl(db));
            lsn = ln.log(envImpl,
                         DbInternal.dbGetDatabaseImpl(db).getId(),
                         key,
View Full Code Here

            /* Log a deleted duplicate LN. */
            LN deleteLN = new LN(data);
            byte[] dupKey = new byte[i+1];
            Arrays.fill(dupKey, (byte)(i+2));

            userTxn.lock
                (deleteLN.getNodeId(), LockType.WRITE,
                 DbInternal.dbGetDatabaseImpl(db));
            lsn = deleteLN.delete(DbInternal.dbGetDatabaseImpl(db),
                                  key,
                                  dupKey,
View Full Code Here

         DbInternal.dbGetDatabaseImpl(db).getId(),
         key, DbLsn.NULL_LSN, null);

            /* Add a MapLN. */
            MapLN mapLN = new MapLN(DbInternal.dbGetDatabaseImpl(db));
            userTxn.lock
                (mapLN.getNodeId(), LockType.WRITE,
                 DbInternal.dbGetDatabaseImpl(db));
            lsn = mapLN.log(envImpl,
                            DbInternal.dbGetDatabaseImpl(db).getId(),
                            key, DbLsn.NULL_LSN, userTxn);
View Full Code Here

            /*
             * Make a user transaction, check lock and release.
             */
            beforeLock = mb.getCacheMemoryUsage();
            Txn userTxn = new Txn(envImpl, new TransactionConfig());
            lockGrant = userTxn.lock
                (ln.getNodeId(), LockType.READ,
                 DbInternal.dbGetDatabaseImpl(db)).
    getLockGrant();
            afterLock = mb.getCacheMemoryUsage();

View Full Code Here

            checkHeldLocks(userTxn, 1, 0);
            long afterDemotion = mb.getCacheMemoryUsage();
            assertEquals(afterLock, afterDemotion);

            // Make it a write lock, then demote.
            lockGrant = userTxn.lock
                (ln.getNodeId(), LockType.WRITE,
                 DbInternal.dbGetDatabaseImpl(db)).
    getLockGrant();
            assertEquals(LockGrantType.PROMOTION, lockGrant);
            long afterWriteLock = mb.getCacheMemoryUsage();
View Full Code Here

                                         
            EnvironmentImpl envImpl = DbInternal.envGetEnvironmentImpl(env);
            Txn userTxn = new Txn(envImpl, new TransactionConfig());

            // get read lock 1
            LockGrantType lockGrant = userTxn.lock
                (ln1.getNodeId(), LockType.READ,
                 DbInternal.dbGetDatabaseImpl(db)).
    getLockGrant();
            assertEquals(LockGrantType.NEW, lockGrant);
            checkHeldLocks(userTxn, 1, 0);
View Full Code Here

    getLockGrant();
            assertEquals(LockGrantType.NEW, lockGrant);
            checkHeldLocks(userTxn, 1, 0);

            // get read lock 2
            lockGrant = userTxn.lock
                (ln2.getNodeId(), LockType.READ,
                 DbInternal.dbGetDatabaseImpl(db)).
    getLockGrant();
            assertEquals(LockGrantType.NEW, lockGrant);
            checkHeldLocks(userTxn, 2, 0);
View Full Code Here

    getLockGrant();
            assertEquals(LockGrantType.NEW, lockGrant);
            checkHeldLocks(userTxn, 2, 0);

            // upgrade read lock 2 to a write
            lockGrant = userTxn.lock
                (ln2.getNodeId(), LockType.WRITE,
                 DbInternal.dbGetDatabaseImpl(db)).
    getLockGrant();
            assertEquals(LockGrantType.PROMOTION, lockGrant);
            checkHeldLocks(userTxn, 1, 1);
View Full Code Here

    getLockGrant();
            assertEquals(LockGrantType.PROMOTION, lockGrant);
            checkHeldLocks(userTxn, 1, 1);

            // read lock 1 again, shouldn't increase count
            lockGrant = userTxn.lock
                (ln1.getNodeId(), LockType.READ,
                 DbInternal.dbGetDatabaseImpl(db)).
    getLockGrant();
            assertEquals(LockGrantType.EXISTING, lockGrant);
            checkHeldLocks(userTxn, 1, 1);
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.