当前位置: 首页>>代码示例>>Java>>正文


Java TransactionConfig.getSync方法代码示例

本文整理汇总了Java中com.sleepycat.je.TransactionConfig.getSync方法的典型用法代码示例。如果您正苦于以下问题:Java TransactionConfig.getSync方法的具体用法?Java TransactionConfig.getSync怎么用?Java TransactionConfig.getSync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sleepycat.je.TransactionConfig的用法示例。


在下文中一共展示了TransactionConfig.getSync方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import com.sleepycat.je.TransactionConfig; //导入方法依赖的package包/类
private void init(EnvironmentImpl envImpl, TransactionConfig config)
throws DatabaseException {

       serializableIsolation = config.getSerializableIsolation();
       readCommittedIsolation = config.getReadCommitted();

       /*
        * Figure out what we should do on commit. TransactionConfig could be
        * set with conflicting values; take the most stringent ones first.
        * All environment level defaults were applied by the caller.
        *
        * ConfigSync  ConfigWriteNoSync ConfigNoSync   default
        *    0                 0             0         sync
        *    0                 0             1         nosync
        *    0                 1             0         write nosync
        *    0                 1             1         write nosync
        *    1                 0             0         sync
        *    1                 0             1         sync
        *    1                 1             0         sync
        *    1                 1             1         sync
        */
       if (config.getSync()) {
           defaultFlushSyncBehavior = TXN_SYNC;
       } else if (config.getWriteNoSync()) {
           defaultFlushSyncBehavior = TXN_WRITE_NOSYNC;
       } else if (config.getNoSync()) {
           defaultFlushSyncBehavior = TXN_NOSYNC;
       } else {
           defaultFlushSyncBehavior = TXN_SYNC;
       }

       lastLoggedLsn = DbLsn.NULL_LSN;
       firstLoggedLsn = DbLsn.NULL_LSN;

       txnState = USABLE;

       /*
        * Note: readLocks, writeInfo, undoDatabases, deleteDatabases are
        * initialized lazily in order to conserve memory. WriteInfo and
        * undoDatabases are treated as a package deal, because they are both
        * only needed if a transaction does writes.
        *
        * When a lock is added to this transaction, we add the collection
        * entry overhead to the memory cost, but don't add the lock
        * itself. That's taken care of by the Lock class.
        */
updateMemoryUsage(MemoryBudget.TXN_OVERHEAD);

       this.envImpl.getTxnManager().registerTxn(this);
   }
 
开发者ID:nologic,项目名称:nabs,代码行数:51,代码来源:Txn.java

示例2: init

import com.sleepycat.je.TransactionConfig; //导入方法依赖的package包/类
private void init(EnvironmentImpl envImpl, TransactionConfig config)
throws DatabaseException {

       serializableIsolation = config.getSerializableIsolation();
       readCommittedIsolation = config.getReadCommitted();

       /* 
        * Figure out what we should do on commit. TransactionConfig could be
        * set with conflicting values; take the most stringent ones first.
        * All environment level defaults were applied by the caller.
        *
        * ConfigSync  ConfigWriteNoSync ConfigNoSync   default
        *    0                 0             0         sync
        *    0                 0             1         nosync
        *    0                 1             0         write nosync
        *    0                 1             1         write nosync
        *    1                 0             0         sync
        *    1                 0             1         sync
        *    1                 1             0         sync
        *    1                 1             1         sync
        */
       if (config.getSync()) {
           defaultFlushSyncBehavior = TXN_SYNC;
       } else if (config.getWriteNoSync()) {
           defaultFlushSyncBehavior = TXN_WRITE_NOSYNC;
       } else if (config.getNoSync()) {
           defaultFlushSyncBehavior = TXN_NOSYNC;
       } else {
           defaultFlushSyncBehavior = TXN_SYNC;
       }

       lastLoggedLsn = DbLsn.NULL_LSN;
       firstLoggedLsn = DbLsn.NULL_LSN;

       txnState = USABLE;

       /* 
        * Note: readLocks, writeInfo, undoDatabases, deleteDatabases are
        * initialized lazily in order to conserve memory. WriteInfo and
        * undoDatabases are treated as a package deal, because they are both
        * only needed if a transaction does writes.
        *
        * When a lock is added to this transaction, we add the collection
        * entry overhead to the memory cost, but don't add the lock
        * itself. That's taken care of by the Lock class.
        */
updateMemoryUsage(MemoryBudget.TXN_OVERHEAD);

       this.envImpl.getTxnManager().registerTxn(this);
   }
 
开发者ID:nologic,项目名称:nabs,代码行数:51,代码来源:Txn.java

示例3: initTxn

import com.sleepycat.je.TransactionConfig; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
private void initTxn(TransactionConfig config)
    throws DatabaseException {

    serializableIsolation = config.getSerializableIsolation();
    readCommittedIsolation = config.getReadCommitted();
    defaultDurability = config.getDurability();
    if (defaultDurability == null) {
        explicitDurabilityConfigured = false;
        defaultDurability = config.getDurabilityFromSync(envImpl);
    } else {
        explicitDurabilityConfigured = true;
    }
    explicitSyncConfigured =
        config.getSync() || config.getNoSync() || config.getWriteNoSync();

    assert (!(explicitDurabilityConfigured && explicitSyncConfigured));

    lastLoggedLsn = NULL_LSN;
    firstLoggedLsn = NULL_LSN;

    txnFlags = 0;
    setState(Transaction.State.OPEN);

    if (envImpl.isReplicated()) {
        buddyLockers =
            new ConcurrentHashMap<BuddyLocker, BuddyLocker>(4, 0.75f, 4);
    }

    txnBeginHook(config);

    /*
     * Note: readLocks, writeInfo, undoDatabases, deleteDatabases are
     * initialized lazily in order to conserve memory. WriteInfo and
     * undoDatabases are treated as a package deal, because they are both
     * only needed if a transaction does writes.
     *
     * When a lock is added to this transaction, we add the collection
     * entry overhead to the memory cost, but don't add the lock
     * itself. That's taken care of by the Lock class.
     */
    updateMemoryUsage(MemoryBudget.TXN_OVERHEAD);

    if (registerImmediately()) {
        this.envImpl.getTxnManager().registerTxn(this);
    }
}
 
开发者ID:prat0318,项目名称:dbms,代码行数:48,代码来源:Txn.java


注:本文中的com.sleepycat.je.TransactionConfig.getSync方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。