Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!

  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Transactions...rolling back cached state?  RSS feed

Kelly Dolan
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I love prototypes! Especially when you learn what *not* to do. Anyway, I'm past the point of no return and I've found myself in a bit of a messy situation and am hoping someone may have a suggestion.
In a session EJB, I am caching some information. It is a combination of some data in a database and some runtime information (i.e., that which is not persisted). I chose not to use an entity EJB because the data doesn't really represent an entity and I chose to cache more than the runtime information because this information is accessed every few milliseconds and performance has to be screaming.
The logic for maintaining this information is (a) perform the database update and if successful (b) update the cache. A typical get() method then simply returns what is in the cache.
When an exception occurs after the point at which my cache is updated, my database updates are rolled back because I'm in a session EJB and have all of that support properly configured. But I'm finding rolling back my cached state is turning into an issue. I cannot simply blow away my cache and reload it from the database because it contains runtime information that is not persisted. Does anyone have a suggestion, know of a pattern or J2EE way of triggering a rollback of inmemory state?
Thanks! Everything and anything is greatly appreciated...
- Kelly
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!