Configuring the Transaction Subsystem

Most of the configuration activities that you need to perform for your transactional BDB XML application will involve the locking and logging subsystems. See Concurrency and Managing BDB XML 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 dbxml.txn;
                                                                                                                                   
import com.sleepycat.db.Environment;
import com.sleepycat.db.EnvironmentConfig;
import com.sleepycat.db.LockDetectMode;

import com.sleepycat.dbxml.XmlManager;
import com.sleepycat.dbxml.XmlManagerConfig;

import java.io.File;

...

Environment myEnv = null;
File envHome = new File("/export1/testEnv");
XmlManager myManager = null;
XmlContainer myContainer = null;
try {
    EnvironmentConfig envConf = new EnvironmentConfig();
    envConf.setAllowCreate(true);         // If the environment does not
                                          // exits, create it.
    envConf.setInitializeCache(true);     // Turn on the shared memory
                                          // region.
    envConf.setInitializeLocking(true);   // Turn on the locking subsystem.
    envConf.setInitializeLogging(true);   // Turn on the logging subsystem.
    envConf.setTransactional(true);       // Turn on the transactional
                                          // subsystem.

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

    myEnv = new Environment(envHome, envConf);

    XmlManagerConfig managerConfig = new XmlManagerConfig();
    myManager = new XmlManager(myEnv, managerConfig);

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

    ...