Previous     Contents     Index     Next     
iPlanet Application Server Administrator's Guide



Chapter 9   Administering Transactions


This chapter describes the tasks and conceptual information necessary for administering transactions using the iPlanet Application Server Administration Tool (iASAT)

The following topics are included in this chapter:



About the Transaction Manager

The transaction manager is installed with each instance of iPlanet Application Server to coordinate global transactions within a Java Server (KJS) process. Global transactions are a set of related operations that must be executed as a unit, though each operation may run in a different process.

You can use global transactions to update a database that uses one or more Enterprise Java Beans (EJBs) running concurrently for the same global transaction, from within one or more KJS processes. This occurs when an EJB triggers another EJB to run and they both participate in the same transaction. You can also update multiple databases that are distributed over different geographic locations or update multiple databases of different types (such as Oracle and Sybase).The transaction manager runs within a KJS process.


New Features

Beginning with iPlanet Application Server, Enterprise Edition 6.5 release, the bundled transaction manager is based on the Java Transaction Service Reference Implementation (JTS RI) with suitable modifications for production environments.

A local transaction manager has also been added for optimization of applications that use local transactions.

The datasource manager now has enhanced functionality and provides support for XADataSource, PooledDataSource and DriverManager. New Connection Pooling infrastructure has been implemented to support pooling of XA connections and Pooled connections.

The following new features have been added to the transaction manager:

  • Flexibility to run both global and local transactions at the same time.

  • Provision for the user to specify the transaction type at three levels:

    • Instance wide

    • At package level (under J2EE-Module/package name)

    • At component level.

    iPlanet Application Server determines the transaction type for a particular component/application by initially referring under the package name, followed by the component <classdef\<guid>, and finally for instance wide value under <CCSO\TXNMGR> in the registry.



    Tip You can achieve better performance by specifying the transaction type at the component level.



  • Support for recovery.

    When iPlanet Application Server starts up, it queries for all pending transactions from all databases used by datasources registered in the registry, and performs recovery. Recovery can also be disabled.

The new transaction manager has better administration control, monitoring and tracing facility. The iPlanet Application Server Administration Tool has been enhanced significantly to support administration and monitoring features.



Administering Distributed Transactions from iASAT



You can administer transactions using the Transaction menu option of iPlanet Application Server Administration Tool.

This section describes the following topics:


About the Transaction Window

The left pane of the Transaction window displays a tree of nodes as shown in the following illustration:

Figure 9-1   

Transaction manager configuration tab

The top level of the tree lists which servers are registered with iASAT. The second level, below each registered server name, displays one or more process nodes. These nodes indicate which processes are running on each registered server. Only Java Server (KJS) processes appear in the tree because only KJS processes support transactions.

The KJS process is displayed alongwith the port number (for example,10819) and the ORB port (for example, 10920) used to connect to the JMS Listener.


Configuring Transactions Per Server

When you select an iPlanet Application Server instance and click Transactions on the menu bar, the global properties for that server instance is displayed. All KJS instances share the properties of iPlanet Application Server except for their identity (Engine Id, port number, etc.). Changes made in this Configuration dialog box will affect all transactions running on that server.

To change transaction settings for an application server, click a registered server in the left pane of the Transaction window. The Configuration tab appears in the right pane as shown here:

Figure 9-2    Transaction properties displayed for a server instance


The following options can be configured:

  • Transaction Type

    You can set the transaction type to either local or global.

    When global transactions are enabled, transactions can span across multiple heterogeneous databases and processes.

  • Time out

    Set this time (in seconds) to rollback a transaction if it's not completed in the stipulated time. This would be helpful in cases where a transaction process was started (for example a stateful session bean), but a bug in the application design prevented its completion.

  • Wait Interval

    The Wait Interval specifies the time (in seconds) iPlanet Application Server will wait before clearing stale or corrupt transactions.

  • Log Directory

    Specify the path where the transaction manager will store its log files. The default is iASInstallDir/ias/logs/jts.


Viewing Transactions Per Server

To view details about a transaction, click the Transaction Manager tab. The Transactions Manager dialog box appears with detailed information on the status of various transactions in progress.



The entries in the detailed view are explained below:

  • Process

    The Process tab displays the KJS engine to which the transaction belongs.

  • Transaction ID

    The transaction ID given to the transaction by the connection pool manager.

  • State

    The four states that are displayed are: prepared, running, rollbacked, committing.

  • Type

    Shows whether the transaction is local or global.

  • Originator

    Originator indicates which servlet or bean originated the transaction.

  • Elapsed Time

    Shows the time since the transaction was started.



    Tip You can click on the table heads to sort the data.




Administering Transactions Per Server

Multiple entries can be selected at a time to control the active transactions. At the bottom of the dialogue box are options which will enable you to control the transactions that are in progress.

  • Mark for Rollback

    Use the Mark for Rollback option to roll back an active transaction. Select the required transaction and click Mark for Rollback.

    You can also roll back multiple transactions at the same time by selecting them while holding the Shift key down, and pressing Mark for Rollback.



    Note Sometimes when you roll back a transaction, you may get a message, "Transaction does not exist". This is because the transaction may have completed before your command got executed.



  • Update

    Click Update periodically to remove expired transactions from view and display currently running transactions in the window.


Administering Transactions Per Process

You can administer each transaction process connected to a particular KJS engine running under the desired iPlanet Application Server instance. This option allows allows you granular control of transactions running on iPlanet Application Server.


Viewing Transactions on a Selected Process

To view the status of transactions on a particular KJS engine, select the required engine in the left pane. The transactions running on that engine will be displayed in the right pane.

Figure 9-3   

Transaction properties displayed for a particular KJS engine.

The entries in the detailed view are explained below:

  • Transaction ID

    The transaction ID given to the transaction by the connection pool manager.

  • State

    The four states that are displayed are: prepared, running, rollbacked, committing.

  • Type

    Shows whether the transaction is local or global.

  • Originator

    Originator indicates which servlet or bean originated the transaction.

  • Elapsed Time

    Shows the time since the transaction was started.



    Tip You can click on the table heads to sort the data.




Administering Transactions Per Process

Select the application server instance in the left pane and then click on the Transactions icon on the menu bar. You will get the dialog box as shown in Figure 9-3.

Multiple entries can be selected at a time to control the active transactions. At the bottom of the dialogue box are options which will enable you to control the transactions that are in progress.

  • Mark for Rollback

    Use the Mark for Rollback option to roll back an active transaction. Select the required transaction and click Mark for Rollback.

    You can also roll back multiple transactions at the same time by selecting them and pressing Mark for Rollback.

  • Freeze Transactions

    Use the Freeze Transactions option to temporarily stop all active transactions. You will be prompted to confirm whether you want to go ahead and stop all transactions.

    Press OK if you want to go ahead or Cancel to exit the Freeze option.

    When the Freeze Transactions option is used, no new transactions will start and existing transactions will be frozen at the next logical step.

  • Unfreeze Transactions

    Use Unfreeze Transactions to resume all transactions that were stopped by the Freeze command.

    You will be prompted for confirmation. Press OK to Unfreeze all existing transactions.

  • Update

    Click Update periodically to remove expired transactions from view and display currently running transactions in the window.



Monitoring Transactions

The monitoring framework enables the display of various properties related to the module. These could be used to get a view of the system's internals to help fine tune application parameters, detect bottlenecks, and check the health of the application.

JTS provides more advanced monitoring facility for transactions. All results are displayed by the admin tool. It provides following features:

  • Displays all active transactions with the following information:

    • Transaction ID

    • Component that started the transaction,

    • Status (prepared, running, rollbacked, committing)

    • Transaction type (global/local)

    • Elapsed time

  • Displays TPM for both local and global transactions.

    A value called sample time is displayed and is editable by the user. The sample time would be used to compute the TPM. And it would be displayed. In addition to a total count, there are two other values- one for local, and one for global.

  • Displays average time taken for each transaction (both global and local). For the sample time, average time for transaction, local transaction and global transaction are displayed.


Configuration Parameters

Configuration parameters provided for transaction manager are as follows:


Table 9-1    Transaction Manager configuration parameters

Configuration parameters

Description

Default Value

DefaultTxnType  

This key will be used to determine the type of transactions.(can be local/global)  

local  

LogDirectory  

This directory will be used for storing jts logs  

$IAS_INSTALLDIR/ias/logs/jts  

RecoveryEnabled  

When the recovery is enabled, when the kjs comes up it will try to recover the pending transactions.(1/0, 1 to enable, 0 to disable)  

0  

Timeout  

Default transaction timeout.(in seconds)  

60  

TimerThreadInterval  

Interval at which the timeout thread will be invoked to clean up the timedout transactions (in seconds).  

30  

TraceEnabled  

Used to enable/disable tracing.(values can be 1 or 0, 1 for enable, 0 for disable).  

0  

TraceFile  

Tracing data will written into this file  

$IAS_INSTALLDIR/ias/logs/txntrace  

TraceLevel  

Used to provide trace level (1 to 6, 1 being low and 6 being high).  

0  

All keys can be found in registry under SOFTWARE/iPlanet/ApplicationServer/6.5/CCS0/TXNMGR




Resolving In-Doubt Transactions

Occasionally, particularly when a Java Server (KJS) process quits suddenly, you may find "hanging" or in-doubt transactions. For Microsoft SQL Server, in order to manually commit or rollback in-doubt transactions, use DTC administrator control. This is also known as DAC. dac.exe is found in the WINNT\SYSTEM32\ directory and is installed with DTC.

After starting DAC, perform the following steps to manually commit or rollback in-doubt transactions:

  1. From the iASAT toolbar, click Transactions to open the Transactions window.

  2. Click the Transaction Manager tab.

  3. Select the transaction that you want to force and click Details.

  4. Click Resolve/Abort to force rollback the transaction.

For Oracle resource managers, if you encounter a "lock held by distributed transaction" error, you must connect to the database and rollback the global transaction explicitly. To do so, perform the following steps:

  1. Find out the local transaction ID that corresponds to the transaction by looking at dba_2pc_pending, which has all the details about pending global transactions.

    For example, type the following at the SQLPLUS prompt:

       SQLPLUS>select * from dba_2pc_pending

  2. Rollback the transaction by typing

       rollback force transaction_id

    at the command line.

For Sybase resource managers, if you encounter a "lock held by distributed transaction" error, you must connect to the database and rollback the global transaction explicitly. To do so, perform the following steps:

  1. Find out the local transaction ID that corresponds to the transaction by running sp_xa_scan_xact, which supplies a list of transaction identifiers.

  2. Use sp_finish_xact with a transaction identifier and a stat (either commit or rollback) to force the branch to complete.






Previous     Contents     Index     Next     
Copyright © 2002 Sun Microsystems, Inc. All rights reserved.

Last Updated March 06, 2002