Package com.sleepycat.je

Examples of com.sleepycat.je.LockStats


                          "The types of locks held in the lock table");
        if (!config.getFast()) {
            dumpLockTable(tableStats, false /*clear*/);
        }
       
        return new LockStats(stats.cloneGroup(config.getClear()),
                             latchStats.cloneGroup(config.getClear()),
                             tableStats.cloneGroup(config.getClear()));
    }
View Full Code Here


        StatsConfig statsConfig = new StatsConfig();

        /* Fast stats will not return NTotalLocks below. */
        statsConfig.setFast(false);

        LockStats lockStat = lockStat(statsConfig);
        if (lockStat.getNTotalLocks() != 0) {
            clean = false;
            System.err.println("Problem: " + lockStat.getNTotalLocks() +
                               " locks left");
            txnManager.getLockManager().dump();
        }

        TransactionStats txnStat = txnStat(statsConfig);
View Full Code Here

        StatsConfig clearStats = new StatsConfig();
        clearStats.setClear(true);

        /* Clear before inserting. */
        LockStats stats = env.getLockStats(clearStats);

        /* Insert key 1, which would lock key 2 while inserting. */
        insert(1);

        /* Expect a single lock was requested. */
        stats = env.getLockStats(clearStats);
        assertEquals(1, stats.getNRequests());

        closeEnv();
    }
View Full Code Here

     * Starts writer thread and waits for it to start the insert.
     */
    private void startInsert(final int keyVal, final int dataVal)
        throws DatabaseException, InterruptedException {

        LockStats origStats = env.getLockStats(null);
        insertFinished = false;

        writerThread = new JUnitThread("Writer") {
            public void testBody()
                throws DatabaseException {
                DatabaseEntry key = new DatabaseEntry();
                DatabaseEntry data = new DatabaseEntry();
                OperationStatus status;
                IntegerBinding.intToEntry(keyVal, key);
                IntegerBinding.intToEntry(dataVal, data);
                Transaction writerTxn = env.beginTransaction(null, txnConfig);
                if (dups) {
                    status = db.putNoDupData(writerTxn, key, data);
                } else {
                    status = db.putNoOverwrite(writerTxn, key, data);
                }
                assertEquals(OperationStatus.SUCCESS, status);
                writerTxn.commitNoSync();
                insertFinished = true;
            }
        };

        writerThread.start();

        long startTime = System.currentTimeMillis();
        while (true) {

            /* Give some time to the writer thread. */
            Thread.yield();
            Thread.sleep(10);
            if (System.currentTimeMillis() - startTime > MAX_INSERT_MILLIS) {
                fail("Timeout doing insert");
            }

            if (txnSerializable) {

                /* Wait for the insert to block. */
                LockStats stats = env.getLockStats(null);
                if (stats.getNWaiters() > origStats.getNWaiters()) {
                    break;
                }
            } else {

                /* Wait for the operation to complete. */
 
View Full Code Here

        StatsConfig statsConfig = new StatsConfig();

        /* Fast stats will not return NTotalLocks below. */
        statsConfig.setFast(false);

        LockStats lockStat = lockStat(statsConfig);
        if (lockStat.getNTotalLocks() != 0) {
            clean = false;
            System.out.println("Problem: " + lockStat.getNTotalLocks() +
                               " locks left");
            txnManager.getLockManager().dump();
        }

        TransactionStats txnStat = txnStat(statsConfig);
View Full Code Here

     * Statistics
     */
    public LockStats lockStat(StatsConfig config)
        throws DatabaseException {
               
        LockStats stats = new LockStats();
        stats.setNRequests(nRequests);
        stats.setNWaits(nWaits);
        if (config.getClear()) {
            nWaits = 0;
            nRequests = 0;
        }

        LatchStats latchStats =(LatchStats) lockTableLatch.getLatchStats();
        stats.setLockTableLatchStats(latchStats);

        /* Dump info about the lock table. */
        if (!config.getFast()) {
            dumpLockTable(stats);
        }
View Full Code Here

    }

    private void checkHeldLocks(Locker txn, int numReadLocks, int numWriteLocks)
        throws DatabaseException {

        LockStats stat = txn.collectStats(new LockStats());
        assertEquals(numReadLocks, stat.getNReadLocks());
        assertEquals(numWriteLocks, stat.getNWriteLocks());
    }
View Full Code Here

                e.printStackTrace();
                fail("Should not get another kind of exception");
            }

            txnA.abort();
            LockStats stats = env.getLockStats(TestUtils.FAST_STATS);
            assertEquals(2, stats.getNWaits());

        } catch (Throwable t) {

            /*
             * Print stack trace before trying to clean up je files in
View Full Code Here

           foundKeyString +
           ")");
        }
    }

                LockStats stat =
                    DbTestProxy.dbcGetCursorImpl(cursor).getLockStats();
                assertEquals(1, stat.getNReadLocks());
                assertEquals(0, stat.getNWriteLocks());
                perData(foundKeyString, foundDataString);
                nEntries++;
    status = getData(foundKey, foundData);
    if (status != OperationStatus.SUCCESS) {
        nHandleEndOfSet++;
View Full Code Here

     * For unit tests
     */
    public LockStats getLockStats()
        throws DatabaseException {

        return locker.collectStats(new LockStats());
    }
View Full Code Here

TOP

Related Classes of com.sleepycat.je.LockStats

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.