users@glassfish.java.net

Re: Global (User) Transaction Timeout

From: sankara rao bhogi <Sankara.Rao_at_Sun.COM>
Date: Fri, 22 May 2009 21:59:30 +0530

Chris,

Transaction completion semantics follows presumed abort protocol, so
when the appclient is down, transaction in the data base should have
been automatically rolled back as you haven't started the commit call on
the transaction. Database server should have identified that the
transaction controller is down and should have aborted the protocol.

Can you verify the when you called system.exit(0); the appclient process
is really down with the help "jps" or "ps -aef"? This is relevant, as if
for some reason appclient process is hanging around.

regards
sankar


glassfish_at_javadesktop.org wrote:
> Hi,
>
> I've been looking through all of the documentation I can find, and I can't seem to find out whether what I'm doing is supposed to work or not...
>
> I have a "Enterprise Application Client" that gets a UserTransaction and a DataSource (whose res-type is XADataSource).
>
> @Resource(name = "jdbc/myDatasource")
> private static DataSource someDataSource;
> @Resource
> static UserTransaction userTransaction;
>
> This data source connects to an MS SQL Server 2005 database using the 1.2 JDBC drivers provided by MS with all the necessary stored procedures installed, and the MSDTC set to participate in XA transactions.
>
> If my program exits in an unclean way then I am left with open transactions on the SQL Server database that will not go away. (I'm forced to use a somewhat buggy component that sometimes causes hard JVM crashes)
>
> userTransaction.begin();
> Connection connection = someDataSource.getConnection();
> Statement statement = connection.createStatement();
> statement.executeUpdate("UPDATE TestTable SET x=x+1 WHERE y=1");
> if (true) {
> System.exit(0);
> }
> // we never get here
> userTransaction.commit();
>
> I have set the transaction-manager to have a non-zero timeout (10), but still SQL Server never seems to become aware that the transaction should be aborted. The MSDTC transaction list shows the transaction as "Active" and seems to have the Glassfish TC as the "Parent" TC...
>
> Any help would be appreciated...
>
> Thanks,
>
> --Chris
> [Message sent by forum member 'christopherrued' (christopherrued)]
>
> http://forums.java.net/jive/thread.jspa?messageID=347261
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>