• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

JTA and web app event listeners  RSS feed

Ranch Hand
Posts: 233
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We wish to perform a transactional table update within the valueUnbound() method of an HttpSessionBindingListener.
The business reason of wanting to do so is that we want to update a user's logon information upon session expiration.
However, in the JTA spec it is specified that web app event listeners may not perform JTA transactions; hence we have a problem doing our transactional update from within valueUnbound().
The spec says that all JTA transactions should be performed from service() threads and the thread invoking valueUnbound is not one. So, we need somehow to make valueUnbound "call" a servlet and
have the servlet's service() (or doGet() for that matter) method do the transactional work.
Getting a dispatcher and asking it to perform a forward is not an attractive solution, since you need to have a request and response object in order to do a forward, so you need to create those and figure out how to set the properties so that the forward works.
Another way of getting a servlet to do the work is getting a URL from the pool, and open a connection to it, where the URL would point to the servlet that would do the transactional work.
However, this seems to be "heavy" performance-wise to me (HTTP traffic involved).
I wonder if you would have some better ideas of doing this.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!