Skip to content

Commit

Permalink
Merge pull request #54 from maxant/BTM-51
Browse files Browse the repository at this point in the history
added docs from archive
  • Loading branch information
lorban committed Oct 20, 2015
2 parents 9188ca9 + e03edaf commit 13a136d
Show file tree
Hide file tree
Showing 47 changed files with 3,326 additions and 0 deletions.
3 changes: 3 additions & 0 deletions btm-docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The files contained in `src/main/asciidoc` are [asciidoc](http://asciidoctor.org/) files. HTML / PDF can be generated out of them using the `asciidoc` tool, or by running `mvn generate-resources`. After Maven runs, you can read the HTML documentation by starting at `target/generated-docs/index.html`.

The original content was lost when the code was moved from codehaus.org over to GitHib. Thanks to web archive, it was possible to get the original content from e.g. [http://web.archive.org/web/20150520175151/https://docs.codehaus.org/display/BTM/Home](http://web.archive.org/web/20150520175151/https://docs.codehaus.org/display/BTM/Home).
35 changes: 35 additions & 0 deletions btm-docs/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.codehaus.btm</groupId>
<artifactId>btm-parent</artifactId>
<version>3.0.0-SNAPSHOT</version>
</parent>

<artifactId>btm-docs</artifactId>
<name>Bitronix Transaction Manager :: Docs</name>
<packaging>pom</packaging>

<build>
<plugins>
<plugin>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctor-maven-plugin</artifactId>
<executions>
<execution>
<id>output-html</id>
<phase>generate-resources</phase>
<goals>
<goal>process-asciidoc</goal>
</goals>
</execution>
</executions>
<configuration>
<backend>html</backend>
</configuration>
</plugin>
</plugins>
</build>

</project>
43 changes: 43 additions & 0 deletions btm-docs/src/main/asciidoc/Build.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
= Building from source

== Contents

* <<prerequisites,Prerequisites>>
* <<source,Getting the Source>>
* <<building,Building>>
* <<ide,IDE Integration>>

[[prerequisites]]
== Prerequisites

You need to have these softwares installed to be able to build BTM:

* GIT
* JDK 1.5
* Apache Maven 2.2.1 (or higher)

[[source]]
== Getting the Source

The project uses GIT as it's source code control system.
The source can be checked out anonymously using:

git clone git://git.codehaus.org/btm-git.git

[[building]]
== Building

The project uses Apache Maven 2 as it's build tool.
Go to the top level directory of the project and type:

mvn install

This will build BTM locally, run tests, build javadoc and install the generated artifacts in your local repository.

[[ide]]
== IDE Integration

Because BTM supports JDBC3 and JDBC4 at the same time, setting up an IDE in a way that there are no errors can be "tricky". See these links for an example of how an IDE can be configured.

* link:ConfiguringIntelliJ.html[Configuring IntelliJ IDE]
* link:ReleaseProcedure.html[Release procedure]
188 changes: 188 additions & 0 deletions btm-docs/src/main/asciidoc/Configuration2x.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
= Configuration

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

* <<howConfig,How to configure BTM>>
** <<props,The properties configuration file>>
** <<setting,Setting values directly on the Configuration object>>
* <<configSettings,Configurable settings>>
** <<txEngine,Transaction engine settings>>
** <<journal,Journal settings>>
** <<timers,Timers settings>>
** <<resourceLoader,Resource Loader settings>>
* <<pools,Connection pools settings>>

[[howConfig]]
== 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.

[[props]]
=== 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.
The properties file is in the default format `key=value`. Ant-like references (`${some.property.name}`) to other properties or to system properties (defined with -D on the command line) are supported.

[[setting]]
=== 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
****
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
****
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.
****

[[configSettings]]
== Configurable settings

There are many different settings that are configurable in the transaction manager. Fortunately, all defaults settings are usually good enough to get started. You only need to tune them when required.

[[txEngine]]
=== Transaction engine settings

These configurable properties are related to the transaction manager's core.

See also https://github.com/bitronix/btm/blob/master/btm/src/main/java/bitronix/tm/Configuration.java.

[options="header", cols="4*"]
|====
|File property name|Configuration property name|Default value|Description
|bitronix.tm.serverId
|serverId
|The machine's IP address but that's unsafe for production usage
|a stable ASCII string that must uniquely identify this TM instance. It must not exceed 51 characters or it will be truncated.
|bitronix.tm.2pc.async
|asynchronous2Pc
|false
|Should two phase commit be executed asynchronously? Asynchronous two phase commit will improve 2PC execution time when there are many resources enlisted in transactions but can be very CPU intensive when used on JDK 1.4 without the java.util.concurrent backport implementation available on the classpath. It also makes debugging more complex. link:ImplementationDetails.html#asynchronous2Pc[See here for more details].
|bitronix.tm.2pc.warnAboutZeroResourceTransactions
|warnAboutZeroResourceTransaction
|true
|Should transactions executed without a single enlisted resource result in a warning or not? Most of the time transactions executed with no enlisted resource reflect a bug or a mis-configuration somewhere.
|bitronix.tm.2pc.debugZeroResourceTransactions debugZeroResourceTransaction false Should creation and commit call stacks of transactions executed without a single enlisted resource tracked and logged or not? This is a companion to `warnAboutZeroResourceTransaction` where the transaction creation and commit call stacks could help you identify the culprit code.
|bitronix.tm.disableJmx
|disableJmx
|false
|The transaction manager registers objects in the JMX registry by default if available. Set this to true to never register JMX objects.
|bitronix.tm.jndi.userTransactionName
|jndiUserTransactionName
|java:comp/UserTransaction
|The name under which the transaction manager will be bound in the internal JNDI provider.
|bitronix.tm.allowMultipleLrc allowMultipleLrc false Should the transaction manager allow multiple LRC resources to be enlisted into the same transaction? Having multiple LRC resources participate in a transaction gives up the recovery guarantee but sometimes is useful in development mode.
|bitronix.tm.currentNodeOnlyRecovery
|currentNodeOnlyRecovery
|true
|Set this to true if you run multiple instances of the transaction manager on the same JMS and JDBC resources to avoid the recovery process to try to recover transactions started by another node. See here for more details.
|====

[[journal]]
=== Journal settings

These configurable properties are related to the disk journal used to record recovery information.

See also https://github.com/bitronix/btm/blob/master/btm/src/main/java/bitronix/tm/Configuration.java.

[options="header", cols="4*"]
|====
|File property name|Configuration property name|Default value|Description
|bitronix.tm.journal
|journal
|disk
|Set the journal to be used to record transaction logs. This can be any of `disk`, `null` or a class name. The disk journal is a classic implementation using two fixed-size files and disk forces, the null journal just allows one to disable logging. This can be useful to run tests. *Do not use the null journal on production as without transaction logs, atomicity cannot be guaranteed.*
|bitronix.tm.journal.disk.logPart1Filename
|logPart1Filename
|btm1.tlog
|Journal fragment file 1.
|bitronix.tm.journal.disk.logPart2Filename
|logPart2Filename
|btm2.tlog
|Journal fragment file 2.
|bitronix.tm.journal.disk.forcedWriteEnabled
|forcedWriteEnabled
|true
|Are logs forced to disk? *Do not set to false on production since without disk force, atomicity cannot be guaranteed.*
|bitronix.tm.journal.disk.forceBatchingEnabled
|forceBatchingEnabled
|true
|Are disk forces batched? Disabling batching can seriously lower the transaction manager's throughput.
|bitronix.tm.journal.disk.maxLogSize
|maxLogSize
|2
|Maximum size in megabytes of the journal fragments. Larger logs allow transactions to stay longer in-doubt but the TM pauses longer when a fragment is full.
|bitronix.tm.journal.disk.filterLogStatus
|filterLogStatus
|false
|Should only mandatory logs be written? Enabling this parameter lowers space usage of the fragments but makes debugging more complex.
|bitronix.tm.journal.disk.skipCorruptedLogs
|skipCorruptedLogs
|false
|Should corrupted transactions log entries be skipped? Use only at last resort when all you have to recover is a pair of corrupted files.
|====

[[timers]]
=== Timers settings

The transaction manager heavily relies on timeouts. All of them can be configured.

See also https://github.com/bitronix/btm/blob/master/btm/src/main/java/bitronix/tm/Configuration.java.

[options="header", cols="4*"]
|====
|File property name|Configuration property name|Default value|Description
|bitronix.tm.timer.defaultTransactionTimeout
|defaultTransactionTimeout
|60
|Default transaction timeout in seconds.
|bitronix.tm.timer.gracefulShutdownInterval
|gracefulShutdownInterval
|60
|Maximum amount of seconds the TM will wait for transactions to get done before aborting them at shutdown time.
|bitronix.tm.timer.backgroundRecoveryInterval
|backgroundRecoveryInterval
|0
|*Deprecated* Interval in minutes at which to run the recovery process in the background. Cannot be disabled.
|bitronix.tm.timer.backgroundRecoveryIntervalSeconds
|backgroundRecoveryIntervalSeconds
|60
|Interval in seconds at which to run the recovery process in the background. Cannot be disabled.
|====

[[resourceLoader]]
=== Resource Loader settings

The resource loader loads and configures XA resources using configuration stored in a properties file. See the Resource Loader page for more details.

See also https://github.com/bitronix/btm/blob/master/btm/src/main/java/bitronix/tm/Configuration.java.

[options="header", cols="4*"]
|====
|File property name |Configuration property name |Default value |Description
|bitronix.tm.resource.configuration
|resourceConfigurationFilename
|none (optional)
|Resource Loader configuration file name.
|====

[[pools]]
== Connection pools settings

JDBC and JMS connection pools configuration are discussed in details in the JDBC pools configuration and the JMS pools configuration pages. Alternatively you can use the Resource Loader instead.
76 changes: 76 additions & 0 deletions btm-docs/src/main/asciidoc/ConfiguringIntelliJ.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
= Configuring IntelliJ IDE

Follow these steps to configure IntelliJ IDE for btm development. These guide assumes you have already downloaded and built the source successfully with Maven.

****
Note: The following steps apply to the Bitronix 2.2 development branch, not prior releases.
****

== Step 1

Start the IntelliJ IDE, and select "New Project..." from the File menu.

image::intellij01.png[]

Select the option "Import project from external model" (which includes Maven support). Click "Next".

image::intellij02.png[]

Select the "Maven" option. Click "Next".

image::intellij03.png[]

* Set the "Root directory" to point to your GIT directory that contains the bitronix project. In the example above, "/Users/brettw/Documents/dev/bitronix"
* Select the checkbox to keep your project files in a separate directory, and select a directory. In the example above, "/Users/brettw/Documents/intellij".
* Select the checkbox to "Import Maven projects automatically".
* Select the checkbox to "Create module groups for multi-module Maven projects".
* Click "Next".

image::intellij04.png[]

Select the 'dist' profile. Click "Next".

image::intellij05.png[]

Check to make sure the bitronix project shows up, and is selected. Click "Next".

image::intellij06.png[]

The defaults should be fine here, just click "Finish".
Your project tree should now look like this:

image::intellij07.png[]

== Step 2
Now we're going to setup the module paths so that IntelliJ can build with both JDBC3 and JDBC4 at the same time.
Right-click on the bitronix project in the project tree, and choose "Open Module Settings" from the menu. A window like this should open:

image::intellij08.png[]

Now, perform these steps for the "btm" module:

- Select the "btm" module in the second pane from the left.
- Click on the "Dependencies" tab for the btm module.
- Select the "btm-jdbc3-stubs" dependency, and move it up, above the Java VM dependency ("1.6 (java version 1.6.0_26)" in the screenshot, possibly "1.5" in your environment).
- The result should look like this:

image::intellij09.png[]

In IntelliJ, dependencies that appear after the JDK are added to the classpath, and dependencies that appear before the JDK are added to the bootclasspath.
Now, perform these steps for the "btm-jdbc4" module:

- Select the "btm-jdbc4" module in the second pane from the left.
- Click on the "Dependencies" tab for the btm-jdbc4 module.
- Select the "btm-jdbc4-stubs" dependency, and move it up, above the Java VM dependency ("1.6 (java version 1.6.0_26)" in the screenshot, possibly "1.5" in your environment).
- The result should look like this:

image::intellij10.png[]

Ok, you're done! Now, click "OK" to dismiss the module settings dialog.

== Step 3

Click on the "Build" menu, and select "Rebuild Project". The projects should now build without error.

*Happy developing! The Bitronix Team welcomes your contribution.*

Loading

0 comments on commit 13a136d

Please sign in to comment.