Sun GlassFish Enterprise Server 2.1 Administration Guide

Configuring Transactions

This section explains how to configure transaction settings:

For additional information about transactions, see these sections:

ProcedureTo configure how the Enterprise Server recovers from transactions

Transactions might be incomplete either because the server crashed or a resource manager crashed. It is essential to complete these stranded transactions and recover from the failures. Enterprise Server is designed to recover from these failures and complete the transactions upon server startup.

While performing the recovery, if some of the resources are unreachable the server restart may be delayed as it tries to recover the transactions.

When the transaction spans across servers, the server that started the transaction can contact the other servers to get the outcome of the transactions. If the other servers are unreachable, the transaction uses the Heuristic Decision field to determine the outcome.

  1. In the tree component select the Configurations node.

  2. If you are running a non-clustered domain in developer profile, skip to the next step. If you are running the domain in cluster profile, select the instance to configure:

    • To configure a particular instance, select the instance’s config node. For example, the default instance, server, select the server-config node.

    • To configure the default settings for all instances, select the default-config node.

  3. Select the Transaction Service node.

  4. To enable the recovery of incomplete transactions, check the Recover in the On Restart field.

  5. Set the amount of time, in seconds, the Enterprise Server tries to connect to the unreachable server in the Retry Timeout field. The default value is 10 minutes (600 seconds).

  6. Set the policy for unreachable servers in a transaction in the Heuristic Decision field.

    Unless there is a good reason to set this field to Commit, leave Heuristic Decision set to Rollback. Committing indeterminate transactions can compromise the data integrity of your application.

  7. Set any needed properties.

    Click the Add Properties button, type values in the Name and Value fields, and check the box to the left of the Name to activate the property.

  8. Click Save.

  9. Restart the Enterprise Server.

ProcedureTo set a transaction timeout value

By default, the server does not timeout a transaction. That is, the server waits indefinitely for a transaction to complete. If you set a timeout value for transactions, if a transaction isn’t completed within the configured time, the Enterprise Server rolls back the transaction.

  1. In the tree component, select the Configurations node.

  2. If you are running a non-clustered domain in developer profile, skip to the next step. If you are running the domain in cluster profile, select the instance to configure:

    • To configure a particular instance, select the instance’s config node. For example, the default instance, server, select the server-config node.

    • To configure the default settings for all instances, select the default-config node.

  3. Select the Transaction Service node.

  4. Enter the number of seconds before the transaction times out, in the Transaction Timeout field.

    The default value of Transaction Timeout is 0 seconds. This disables transaction timeouts.

  5. Click Save.

  6. Restart the Enterprise Server.

ProcedureTo set the location of the transaction logs

The transaction log records the information about each transaction in order to maintain the data integrity of the resources involved and to recover from failures. Transaction logs are kept in the tx subdirectory of the directory specified by the Transaction Log Location field. These logs are not human readable.

  1. In the tree component, select the Configurations node.

  2. If you are running a non-clustered domain in developer profile, skip to the next step. If you are running the domain in cluster profile, select the instance to configure:

    • To configure a particular instance, select the instance’s config node. For example, the default instance, server, select the server-config node.

    • To configure the default settings for all instances, select the default-config node.

  3. Select the Transaction Service node.

  4. Enter the location of the transaction logs in the Transaction Log Location field.

    A tx subdirectory is created and transaction logs are kept under that directory.

    The default value is ${com.sun.aas.instanceRoot}/logs. The ${com.sun.aas.instanceRoot} variable is the name of the instance, and is set when you start an Enterprise Server instance. To see the value of ${com.sun.aas.instanceRoot}, click Actual Values.

  5. Click Save.

  6. Restart the Enterprise Server.

ProcedureTo set the keypoint interval

Keypoint operations compress the transaction log file. The keypoint interval is the number of transactions between keypoint operations on the log. Keypoint operations can reduce the size of the transaction log files. A larger number of keypoint intervals (for example, 2048) results in larger transaction log files, but fewer keypoint operations, and potentially better performance. A smaller keypoint interval (for example, 256) results in smaller log files but slightly reduced performance due to the greater frequency of keypoint operations.

  1. In the tree component select the Configurations node.

  2. If you are running a non-clustered domain in developer profile, skip to the next step. If you are running the domain in cluster profile, select the instance to configure:

    • To configure a particular instance, select the instance’s config node. For example, the default instance, server, select the server-config node.

    • To configure the default settings for all instances, select the default-config node.

  3. Select the Transaction Service node.

  4. Enter the number of transactions between keypoint operations in the Keypoint Interval field.

    The default value is 65536.

  5. Click Save.

  6. Restart the Enterprise Server.