当前位置: 首页>>代码示例>>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;未经允许,请勿转载。