noamrotem wrote:
However, I keep getting inconsistent exceptions and behaviors when doing that
Could you elaborate on that? Could you provide stack traces?
Your problem is far from simple with multithreading and session/transaction that are closed asynchroneously. So it's pretty hard to give smart advices from the distance.
When I first read your post, I thought I would try to attack the problem using evict on the Event objects in the session they're coming from and lock in the session with the Incident. Meanwhile I doubt that this would be better than what you've already tried.
The central issue seems to be that you cannot do anything with an Event as long as you're not sure the session/transaction it is saved in is actually terminated. You would need some clever synchronisation mechanism.
I'm wondering if you could not simplify/redesign your application so that you get rid of the whole problem. Again, it's very difficult to say anything knowing so little about your application and without knowledge which alternative you have already tried. For example: why can't the Event objects be saved in the Incident thread?
noamrotem wrote:
Your help will be unbelievably life saving.
I really hope that no life depends on the solution to this problem...
Erik