"oglueck" wrote : Well, easiest for me would be a callback method on the MDB
like
|
| void onCommitException(Throwable t);
|
| (How to register it, is another issue). But as you say the commit is issued
by the pool I am not sure if that is still possible at that point or if the
instance has already been dismissed.
|
Correct, the MDB instance that originally processed the message is probably
doing
something else by the time the commit fails.
anonymous wrote :
| Today it is a real problem when the MDB is the one who commits a
transaction. All the real interesting exceptions happen on commit (because DB
constraints fire then mostly). With CMT I loose the exception.
|
The code you want to change is in StdServerSession's run()
| catch (Exception e)
| {
| log.error("session failed to run; setting rollback only", e);
|
| if (useLocalTX)
| {
| // Use JBossMQ One Phase Commit to commit the TX
| localRollbackFlag = true;
| }
| else
| {
| // Mark for tollback TX via TM
| try
| {
| // The transaction will be rolledback in the finally
| if (trace)
| log.trace("Using TM to mark TX for rollback.");
| trans.setRollbackOnly();
| }
| catch (Exception x)
| {
| log.error("failed to set rollback only", x);
| }
| }
|
| }
| finally
| {
| try
| {
| if (useLocalTX)
| {
| if (localRollbackFlag == true)
| {
| if (trace)
| log.trace("Using optimized 1p commit to rollback TX.");
|
| XAResource res = xaSession.getXAResource();
| res.end(localXid, XAResource.TMSUCCESS);
| res.rollback(localXid);
|
| }
| else
| {
| if (trace)
| log.trace("Using optimized 1p commit to commit TX.");
|
| XAResource res = xaSession.getXAResource();
| res.end(localXid, XAResource.TMSUCCESS);
| res.commit(localXid, true);
| }
| }
| else
| {
| // Use the TM to commit the Tx (assert the correct
association)
| Transaction currentTx = tm.getTransaction();
| if (trans.equals(currentTx) == false)
| throw new IllegalStateException("Wrong tx association:
expected " + trans + " was " + currentTx);
|
| // Marked rollback
| if (trans.getStatus() == Status.STATUS_MARKED_ROLLBACK)
| {
| if (trace)
| log.trace("Rolling back JMS transaction");
| // actually roll it back
| tm.rollback();
|
| // NO XASession? then manually rollback.
| // This is not so good but
| // it's the best we can do if we have no XASession.
| if (xaSession == null && serverSessionPool.isTransacted())
| {
| session.rollback();
| }
| }
| else if (trans.getStatus() == Status.STATUS_ACTIVE)
| {
| // Commit tx
| // This will happen if
| // a) everything goes well
| // b) app. exception was thrown
| if (trace)
| log.trace("Commiting the JMS transaction");
| tm.commit();
|
| // NO XASession? then manually commit. This is not so
good but
| // it's the best we can do if we have no XASession.
| if (xaSession == null && serverSessionPool.isTransacted())
| {
| session.commit();
| }
| }
| }
| }
| catch (Exception e)
| {
| log.error("failed to commit/rollback", e);
| }
| }
| if (trace)
| log.trace("onMessage done");
|
anonymous wrote :
| And with BMT I can not push the message back to the queue:
http://jira.jboss.com/jira/browse/EJBTHREE-351
| I am sort of helpless.
You also have control if you have JCA1.5 resource adapter for JMS
that does transaction inflow. i.e. you start and commit the transaction
from the "activation".
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3911142#3911142
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3911142
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user