Hmmn... You are right this is problematic. Each time when a pojo is attached, a new cache node will be created under __JBossInternal__. So for optimistic locking this will be problem for concurrent transaction. This will evitably create high rate of rollback and degrade the performance.
I ahve created a jira:
A partial workaround is to use "region" in cache such that __JBossInternal__ is separate for each region. However, for concurrent access under the same region, the problem would still exist.
Any reason that you must use optimistic locking?
Does this also affect the 1.4.x series? Specifically 1.4.1.CR1 (released earlier today) with a lot of improvements around optimistic locking concurrency? (These improvements will make it into the next 2.0.0.ALPHA2 as well)
It is not that servere in 1.4 because __JBossInternal__ is used only for shared references. So if there is creation of shared reference POJO under concurrent tx, then it will rollback. Otherwise, thing as usual.
Thanks for your reply.
Unfortunately, I need to use optimistic locking because in my usage scenario, deadlock prevention and/or recovery will be very hard when using pessimistic locking... That was one of the reasons for us to use JBossCache in the first place...
Any chance this will get fixed in ALPHA2 ?