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 8 Next »

Resource Loader

The Resource Loader is a facility that allows easy configuration and management of resources. Pools configured via the Resource Loader will be created automatically during the transaction manager's startup and will be closed during its shutdown.

It consists of an extra layer above the JDBC and JMS pools which configures them via a properties file. It is not mandatory to use it but sometimes it is better than manually creating resource pools. Another good example of Resource Loader usage is when BTM is embedded in a servlet container which configuration file cannot easily be extended, like Tomcat for instance.

Contents

Enabling the Resource Loader

You can enable it by setting the bitronix.tm.resource.configuration property in the configuration file or by calling setResourceConfigurationFilename() on the Configuration object.

This property must contain a path to a properties file that will be loaded by the Resource Loader to create pools. Its default value is null which means the Resource Loader is disabled and resources should be manually created via the API.

Configuring a JDBC pool

You can configure a JDBC connection pool that wraps the driver's javax.sql.XADataSource implementation and presents it to the user as a javax.sql.DataSource, much like with the API.

To configure a JDBC pool, create a set of properties:

(A) is constant and never changes.
(B) is an arbitrary name used to group a set of properties together.
(C) is a javabean property of bitronix.tm.resource.jdbc.PoolingDataSource.

Refer to the PoolingDataSource javadoc or to the JDBC configuration page to know what properties can be set.

Configuring a JMS pool

You can configure a JMS connection pool that wraps JMS server's javax.jms.XAConnectionFactory implementation and presents it to the user as a javax.jms.ConnectionFactory, much like with the API or for JDBC.

To configure a JMS pool, create a set of properties:

(A) is constant and never changes.
(B) is an arbitrary name used to group a set of properties together.
(C) is a javabean property of bitronix.tm.resource.jms.PoolingConnectionFactory.

Refer to the PoolingConnectionFactory javadoc or to the JMS configuration page to know what properties can be set.

Ant-like references

Unlike the transaction manager, the Resource Loader does not support ant-like references (${...}) in its configuration file.

JNDI binding

You can optionally have the Resource Loader bind resources to JNDI after configuration by setting this property to true:

Resources are then bound in the default JNDI context using their unique name as the JNDI name.

  • No labels