com.sleepycat.je.TransactionConfig Java Examples

The following examples show how to use com.sleepycat.je.TransactionConfig. 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: ReplicatedEnvironmentFacadeTest.java    From qpid-broker-j with Apache License 2.0 6 votes vote down vote up
@Test
public void testBeginTransaction() throws Exception
{
    ReplicatedEnvironmentFacade facade = createMaster();
    Transaction txn = null;
    try
    {
        TransactionConfig transactionConfig = new TransactionConfig();
        transactionConfig.setDurability(facade.getRealMessageStoreDurability());
        txn = facade.beginTransaction(transactionConfig);
        assertNotNull("Transaction is not created", txn);
        txn.commit();
        txn = null;
    }
    finally
    {
        if (txn != null)
        {
            txn.abort();
        }
    }
}
 
Example #2
Source File: ReplicatedEnvironmentFacadeTest.java    From qpid-broker-j with Apache License 2.0 5 votes vote down vote up
private void putRecord(final ReplicatedEnvironmentFacade master, final Database db, final int keyValue,
                       final String dataValue)
{
    DatabaseEntry key = new DatabaseEntry();
    DatabaseEntry data = new DatabaseEntry();

    TransactionConfig transactionConfig = new TransactionConfig();
    transactionConfig.setDurability(master.getRealMessageStoreDurability());
    Transaction txn = master.beginTransaction(transactionConfig);
    IntegerBinding.intToEntry(keyValue, key);
    StringBinding.stringToEntry(dataValue, data);

    db.put(txn, key, data);
    txn.commit();
}
 
Example #3
Source File: StandardEnvironmentFacade.java    From qpid-broker-j with Apache License 2.0 4 votes vote down vote up
@Override
public Transaction beginTransaction(TransactionConfig transactionConfig)
{
    return getEnvironment().beginTransaction(null, transactionConfig);
}
 
Example #4
Source File: OrphanConfigurationRecordPurger.java    From qpid-broker-j with Apache License 2.0 4 votes vote down vote up
private void purge() throws Exception
{
    EnvironmentConfig config = EnvironmentConfig.DEFAULT;
    config.setAllowCreate(false);
    config.setTransactional(true);

    try (Environment env = createEnvironment(config))
    {
        final int version = getVersion(env, READ_ONLY_DB_CONFIG);
        if (!ALLOWED_VERSIONS.contains(version))
        {
            throw new IllegalStateException(String.format("Store has unexpected version. Found %d expected %s",
                                                          version, ALLOWED_VERSIONS));
        }

        final Transaction tx = env.beginTransaction(null, TransactionConfig.DEFAULT);
        boolean success = false;
        try
        {
            purgeOrphans(env, tx);
            success = true;
        }
        finally
        {
            if (!success)
            {
                System.out.println("No config or config hierarchy records purged.");
                tx.abort();
            }
            else if (_dryRun)
            {
                System.out.println("No config or config hierarchy records purged - -dryRun flag specified.");
                tx.abort();
            }
            else
            {
                tx.commit();
                System.out.format("Config records(s) and associated hierarchy records purged.");
            }
        }
    }
}
 
Example #5
Source File: JE_Transaction.java    From tddl5 with Apache License 2.0 4 votes vote down vote up
public JE_Transaction(com.sleepycat.je.Transaction txn, com.sleepycat.je.TransactionConfig config,
                      AtomicReference<ITHLog> historyLog){
    this.txn = txn;
    this.config = config;
    this.historyLog = historyLog;
}
 
Example #6
Source File: JE_Transaction.java    From tddl with Apache License 2.0 4 votes vote down vote up
public JE_Transaction(com.sleepycat.je.Transaction txn, com.sleepycat.je.TransactionConfig config,
                      AtomicReference<ITHLog> historyLog){
    this.txn = txn;
    this.config = config;
    this.historyLog = historyLog;
}
 
Example #7
Source File: EnvironmentFacade.java    From qpid-broker-j with Apache License 2.0 votes vote down vote up
Transaction beginTransaction(TransactionConfig transactionConfig);