本文整理汇总了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;
}
示例2: getTransactionStats
import com.sleepycat.je.TransactionStats; //导入依赖的package包/类
/**
* @see Environment#getTransactionStats(StatsConfig)
*/
public TransactionStats getTransactionStats(StatsConfig config) throws DatabaseException {
return delegate().getTransactionStats(config);
}
示例3: txnStat
import com.sleepycat.je.TransactionStats; //导入依赖的package包/类
/**
* Retrieve txn statistics
*/
synchronized public TransactionStats txnStat(StatsConfig config)
throws DatabaseException {
return txnManager.txnStat(config);
}
示例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;
}
}
示例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;
}
}
示例6: txnStat
import com.sleepycat.je.TransactionStats; //导入依赖的package包/类
/**
* Retrieve txn statistics
*/
public synchronized TransactionStats txnStat(StatsConfig config) {
return txnManager.txnStat(config);
}