Java源码示例:com.sleepycat.je.Durability.ReplicaAckPolicy

示例1
/**
 * This method should only be invoked from configuration thread on virtual host activation.
 * Otherwise, invocation of this method whilst coalescing committer is committing transactions might result in transaction aborts.
 */
public void setMessageStoreDurability(SyncPolicy localTransactionSynchronizationPolicy, SyncPolicy remoteTransactionSynchronizationPolicy, ReplicaAckPolicy replicaAcknowledgmentPolicy)
{
    if (_messageStoreDurability == null || localTransactionSynchronizationPolicy != _messageStoreDurability.getLocalSync()
            || remoteTransactionSynchronizationPolicy != _messageStoreDurability.getReplicaSync()
            || replicaAcknowledgmentPolicy != _messageStoreDurability.getReplicaAck())
    {
        _messageStoreDurability = new Durability(localTransactionSynchronizationPolicy, remoteTransactionSynchronizationPolicy, replicaAcknowledgmentPolicy);

        if (_coalescingCommiter != null)
        {
            _coalescingCommiter.stop();
            _coalescingCommiter = null;
        }

        if (localTransactionSynchronizationPolicy == LOCAL_TRANSACTION_SYNCHRONIZATION_POLICY)
        {
            localTransactionSynchronizationPolicy = SyncPolicy.NO_SYNC;
            _coalescingCommiter = new CoalescingCommiter(_configuration.getGroupName(), this);
            _coalescingCommiter.start();
        }
        _realMessageStoreDurability = new Durability(localTransactionSynchronizationPolicy, remoteTransactionSynchronizationPolicy, replicaAcknowledgmentPolicy);
    }
}