當前位置: 首頁>>代碼示例>>Java>>正文


Java TransactionStats類代碼示例

本文整理匯總了Java中com.sleepycat.je.TransactionStats的典型用法代碼示例。如果您正苦於以下問題:Java TransactionStats類的具體用法?Java TransactionStats怎麽用?Java TransactionStats使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


TransactionStats類屬於com.sleepycat.je包,在下文中一共展示了TransactionStats類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: txnStat

import com.sleepycat.je.TransactionStats; //導入依賴的package包/類
/**
    * Collect transaction related stats.
    */
   public TransactionStats txnStat(StatsConfig config)
       throws DatabaseException {

       TransactionStats stats = new TransactionStats();
       allTxnLatch.acquire();
try {
    stats.setNCommits(numCommits);
    stats.setNAborts(numAborts);
    stats.setNXAPrepares(numXAPrepares);
    stats.setNXACommits(numXACommits);
    stats.setNXAAborts(numXAAborts);
    stats.setNActive(allTxns.size());
    TransactionStats.Active[] activeSet =
	new TransactionStats.Active[stats.getNActive()];
    stats.setActiveTxns(activeSet);
    Iterator iter = allTxns.iterator();
    int i = 0;
    while (iter.hasNext()) {
	Locker txn = (Locker) iter.next();
	activeSet[i] = new TransactionStats.Active
	    (txn.toString(), txn.getId(), 0);
	i++;
    }
    if (config.getClear()) {
	numCommits = 0;
	numAborts = 0;
	numXACommits = 0;
	numXAAborts = 0;
    }
} finally {
    allTxnLatch.release();
}
       return stats;
   }
 
開發者ID:nologic,項目名稱:nabs,代碼行數:38,代碼來源:TxnManager.java

示例2: getTransactionStats

import com.sleepycat.je.TransactionStats; //導入依賴的package包/類
/**
 * @see Environment#getTransactionStats(StatsConfig)
 */
public TransactionStats getTransactionStats(StatsConfig config) throws DatabaseException {
    return delegate().getTransactionStats(config);
}
 
開發者ID:jronrun,項目名稱:benayn,代碼行數:7,代碼來源:Berkeley.java

示例3: txnStat

import com.sleepycat.je.TransactionStats; //導入依賴的package包/類
/**
 * Retrieve txn statistics
 */
synchronized public TransactionStats txnStat(StatsConfig config)
    throws DatabaseException {

    return txnManager.txnStat(config);
}
 
開發者ID:nologic,項目名稱:nabs,代碼行數:9,代碼來源:EnvironmentImpl.java

示例4: testBasicDb

import com.sleepycat.je.TransactionStats; //導入依賴的package包/類
/**
 * Test use through db.
 */
public void testBasicDb()
    throws Throwable {

    try {
        TransactionStats stats =
            env.getTransactionStats(TestUtils.FAST_STATS);
        assertEquals(0, stats.getNAborts());
        int initialCommits = 1; // 1 commits for adding UP database
        assertEquals(initialCommits, stats.getNCommits());

        int numKeys = 7;
        createDbs();

        // Insert data with autocommit
        dbInsertData(0, numKeys, null);
        verifyData(numKeys, 0);

        // Insert data with a txn
        Transaction txn = env.beginTransaction(null, null);
        dbInsertData(numKeys, numKeys*2, txn);
        txn.commit();
        verifyData(numKeys*2, 0);

        stats = env.getTransactionStats(TestUtils.FAST_STATS);
        assertEquals(0, stats.getNAborts());
        assertEquals((initialCommits + 1 +  // 1 explicit commit above
                      (1 * NUM_DBS) +       // 1 per create/open
                      (numKeys*NUM_DBS)),   // 1 per record, using autotxn
stats.getNCommits());

        // delete data with a txn, abort
        txn = env.beginTransaction(null, null);
        dbDeleteData(numKeys, numKeys * 2, txn);
        verifyData(numKeys, 0);  // verify w/dirty read
        txn.abort();

        closeAll();
    } catch (Throwable t) {
        t.printStackTrace();
        throw t;
    }
}
 
開發者ID:nologic,項目名稱:nabs,代碼行數:46,代碼來源:TxnEndTest.java

示例5: testBasicDb

import com.sleepycat.je.TransactionStats; //導入依賴的package包/類
/**
 * Test use through db.
 */
public void testBasicDb()
    throws Throwable {

    try {
        TransactionStats stats =
            env.getTransactionStats(TestUtils.FAST_STATS);
        assertEquals(0, stats.getNAborts());
        int initialCommits = 1; // 1 commits for adding UP database
        assertEquals(initialCommits, stats.getNCommits());

        int numKeys = 7;
        createDbs();

        // Insert data with autocommit
        dbInsertData(0, numKeys, null);
        verifyData(numKeys, 0);

        // Insert data with a txn
        Transaction txn = env.beginTransaction(null, null);
        dbInsertData(numKeys, numKeys*2, txn);
        txn.commit();
        verifyData(numKeys*2, 0);

        stats = env.getTransactionStats(TestUtils.FAST_STATS);
        assertEquals(0, stats.getNAborts());
        assertEquals((initialCommits + 1 +  // 1 explicit commit above
                      (1 * NUM_DBS) +       // 1 per create/open
                      (numKeys*NUM_DBS)),   // 1 per record, using autotxn
stats.getNCommits());

        // delete data with a txn, abort
        txn = env.beginTransaction(null, null);
        dbDeleteData(numKeys, numKeys * 2, txn);
        verifyData(numKeys, 0);  // verify w/dirty read    
        txn.abort();
        
        closeAll();
    } catch (Throwable t) {
        t.printStackTrace();
        throw t;
    }
}
 
開發者ID:nologic,項目名稱:nabs,代碼行數:46,代碼來源:TxnEndTest.java

示例6: txnStat

import com.sleepycat.je.TransactionStats; //導入依賴的package包/類
/**
 * Retrieve txn statistics
 */
public synchronized TransactionStats txnStat(StatsConfig config) {
    return txnManager.txnStat(config);
}
 
開發者ID:prat0318,項目名稱:dbms,代碼行數:7,代碼來源:EnvironmentImpl.java


注:本文中的com.sleepycat.je.TransactionStats類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。