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, you can also configure the maximum number of simultaneous transactions needed by your application. In general, you should not need to do this unless you use deeply nested transactions or you have many threads all of which have active transactions. In addition, you may need to configure a higher maximum number of transactions if you are using snapshot isolation. See Snapshot Isolation Transactional Requirements for details.
By default, your application can support 20 active transactions.
You can set the maximum number of simultaneous
transactions supported by your application using
EnvironmentConfig.setTxnMaxActive()
.
If your application has exceeded this maximum value, then any attempt to begin a new transaction will fail.
This value can also be set using the
DB_CONFIG
file's
set_tx_max
parameter. Remember that
the DB_CONFIG
must reside in your
environment home directory.
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 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). ...