Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Next »

Configuration

Incomplete

Icon

This page is not yet complete but still contains useful information.

BTM configuration settings are stored in a Configuration object. It can be obtained by calling TransactionManagerServices.getConfiguration(). All settings are documented in the javadoc and you should refer to it to know what can be configured.

Contents

How to configure BTM

The Configuration object is implemented with sensible default settings. For a first time user, all default settings are good enough. After the initial testing phase, you might want to change some settings. This can be done in two ways: via a properties configuration file or by setting values directly on the Configuration object.

The properties configuration file

You can create a properties file in which you'll set some configuration settings. All the ones you omit will keep their default value.

The file can be stored anywhere on the file system in which case you need to set the bitronix.tm.configuration system property to tell BTM where the file lies. This is generally done by adding a -D argument to the virtual machine's command line:

java -Dbitronix.tm.configuration=./my-btm-config.properties MyClass

Another way is to call the properties file bitronix-default-config.properties and store it at the root of your classpath.

Setting values directly on the Configuration object

You can call any setter you want on the object you get from the call to TransactionManagerServices.getConfiguration(). This is convenient if you do not want to use the properties file to configure BTM but want to leverage - for instance - Spring instead.

Configuration conf = TransactionManagerServices.getConfiguration();
conf.setServerId("jvm-1");
conf.setLogPart1Filename("./tx-logs/part1.btm");
conf.setLogPart2Filename("./tx-logs/part2.btm");

Read only configuration

Icon

Once BTM has started, any attempt to call a set method on the Configuration object will throw a IllegalStateException.

Since the Configuration object is a singleton, there is no need to pass it to any other object, BTM will pick it up at startup.

Configuration dropped after restart

Icon

The Configuration object is dropped during BTM shutdown. You need to call all setters methods again before you restart the transaction manager. Keep this in mind if you plan to hot-redeploy your application in your application server.

  • No labels