TransactionStart called for all applications, why?

Hi,

Is there some reason (which I just can’t figure out right now) why all transactionStart() are called if I have several applications with their own TransactionListeners?

My case is that I have several portlets and they have their own TransactionListeners added to the different applications. Still if any open application’s transactionStart() is called, then all other open application’s transactionStart() is also called. This is of course quite easy to bybass by including an


public void transactionStart(Application app, Object req) {
if(app == MyApplication.this) {
// transaction called by MyApplication
} else {
// SomeOtherApplication started transaction, but I can listen to it's transaction here
}
}

// Jonas

This could be a bug, please write a ticket.

TransactionListener resides within ApplicationContext, from the javadocs:

ApplicationContext provides information about the running
context of the application. Each context is shared by all applications that
are open for one user. In web-environment this corresponds to HttpSession.

So, isn’t TransactionSttart supposed to work this way. If you got multiple Toolkit applications within same ApplicationContext (read HTTP session) and client starts an transaction => all applications residing in the same context are notified through TransactionListener mechanism.

But, I’d vote that someone enhances TransactionListener interface’s javadoc.

Ah, of course. I think you have a point there. It just behaves this way, although I think that it’s seldomly needed. I don’t think it’s necessary to break this in Toolkit either, but just let it behave like it should as a part of ApplicationContext.

I created a ticket regarding some clarification of JavaDoc: http://dev.itmill.com/ticket/2158