DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

Configuring the Transaction Subsystem

Most of the configuration activities that you need to perform for your transactional JE application will involve the locking and logging subsystems. See Concurrency and Managing JE Files for details.

However, there are a couple of things that you can do to configure your transaction subsystem directly. These things are:

For example:

package db.txn;

import com.sleepycat.db.Environment;
import com.sleepycat.db.EnvironmentConfig;
import com.sleepycat.db.LockDetectMode;

import java.io.File;

...

Environment myEnv = null;
try {
    EnvironmentConfig myEnvConfig = new EnvironmentConfig();
    myEnvConfig.setTransactional(true);
    myEnvConfig.setInitializeCache(true);
    myEnvConfig.setInitializeLocking(true);
    myEnvConfig.setInitializeLogging(true);

    // Configure a maximum transaction timeout of 1 second.
    myEnvConfig.setTxnTimeout(1000000);
    // Configure 40 maximum transactions.
    myEnv.setTxnMaxActive(40);

    myEnv = new Environment(new File("/my/env/home"),
                              myEnvConfig);

    // From here, you open your databases, proceed with your 
    // database operations, and respond to deadlocks as 
    // is normal (omitted for brevity).

    ...