MQ Base classes for Java :- intermittent mqrc 2128 :UoW is already in progress

223 views Asked by At

We are using MQ base classes and MQ as a XA transaction coordinator.

Environment 

MQ 7.5 Red Hat Linux 6.4 Java 1.7

Scenario :

1. MqManager.begin

  1. queue. get (sync point set in get option)
  2. db save
  3. MqManager.commit/rollback
  4. go back to step 1

Most of the time step 5 i. e. starting of the new transaction works fine however intermittently exception is thrown UoW already in progress. Since step 4 call was successful we believed transaction should be either committed or rolled back successfully. It shouldn't cause issues when a new transaction is being started. Can someone please suggest what can be causing UoW not being committed or rolled back even after successful commit/rollback call on the q manager?

Thanks Vaibhav

1

There are 1 answers

0
Talijanac On

You are probably caching JMS consumers or some other JMS objects.

Essentially at lower level MQ conversation is driven by various lower level client calls like PUT, GET or MQOPEN commands. Your problem is that issued MQBEGIN command was not matched by proper MQCLOSE (?) command. This all happens in JMS driver and it is hidden from Java developer.

If I remember correctly MQBEGIN call is mapped to the creation o jms consumer. Closing all jms object's but connection itself will work.

There is downfall to this. Problem with closing all JMS objects is that it increases cpu usage, as MQOPEN and similar calls tend to be CPU expensive.