com.sleepycat.je.Durability.SyncPolicy Java Examples

The following examples show how to use com.sleepycat.je.Durability.SyncPolicy. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ReplicatedEnvironmentFacade.java    From qpid-broker-j with Apache License 2.0 6 votes vote down vote up
@Override
public void commit(final Transaction tx, boolean syncCommit)
{
    try
    {
        // Using commit() instead of commitNoSync() for the HA store to allow
        // the HA durability configuration to influence resulting behaviour.
        tx.commit(_realMessageStoreDurability);
    }
    catch (DatabaseException de)
    {
        throw handleDatabaseException("Got DatabaseException on commit, closing environment", de);
    }

    if (_coalescingCommiter != null && _realMessageStoreDurability.getLocalSync() == SyncPolicy.NO_SYNC
            && _messageStoreDurability.getLocalSync() == SyncPolicy.SYNC)
    {
        _coalescingCommiter.commit(tx, syncCommit);
    }

}
 
Example #2
Source File: ReplicatedEnvironmentFacade.java    From qpid-broker-j with Apache License 2.0 6 votes vote down vote up
@Override
public <X> ListenableFuture<X> commitAsync(final Transaction tx, final X val)
{
    try
    {
        // Using commit() instead of commitNoSync() for the HA store to allow
        // the HA durability configuration to influence resulting behaviour.
        tx.commit(_realMessageStoreDurability);
    }
    catch (DatabaseException de)
    {
        throw handleDatabaseException("Got DatabaseException on commit, closing environment", de);
    }

    if (_coalescingCommiter != null && _realMessageStoreDurability.getLocalSync() == SyncPolicy.NO_SYNC
        && _messageStoreDurability.getLocalSync() == SyncPolicy.SYNC)
    {
        return _coalescingCommiter.commitAsync(tx, val);
    }
    return Futures.immediateFuture(val);
}
 
Example #3
Source File: ReplicatedEnvironmentFacade.java    From qpid-broker-j with Apache License 2.0 6 votes vote down vote up
/**
 * 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);
    }
}
 
Example #4
Source File: BDBHAVirtualHostImpl.java    From qpid-broker-j with Apache License 2.0 5 votes vote down vote up
@Override
public void onOpen()
{
    ReplicatedEnvironmentFacade facade = getReplicatedEnvironmentFacade();
    if (facade != null)
    {
        facade.setMessageStoreDurability(
                SyncPolicy.valueOf(getLocalTransactionSynchronizationPolicy()),
                SyncPolicy.valueOf(getRemoteTransactionSynchronizationPolicy()),
                ReplicatedEnvironmentFacade.REPLICA_REPLICA_ACKNOWLEDGMENT_POLICY);
    }
    super.onOpen();
}
 
Example #5
Source File: BDBHAVirtualHostImpl.java    From qpid-broker-j with Apache License 2.0 5 votes vote down vote up
private void validateTransactionSynchronizationPolicy(String policy)
{
    try
    {
        SyncPolicy.valueOf(policy);
    }
    catch(Exception e)
    {
        throw new IllegalArgumentException("Invalid transaction synchronization policy '" + policy + "'. " + e.getMessage());
    }
}
 
Example #6
Source File: BDBHAVirtualHostImpl.java    From qpid-broker-j with Apache License 2.0 4 votes vote down vote up
@Override
public boolean isCoalescingSync()
{
    return SyncPolicy.SYNC.name().equals(_localTransactionSynchronizationPolicy);
}