[hibernate-dev] (HHH-9857) Reuse of EntityEntry for bytecode enhanced read-only reference cached entities

John O'Hara johara at redhat.com
Tue Jun 16 09:57:07 EDT 2015


Steve,

I missed you ping yesterday about HHH-9857. I reworked based on the 
EntityEntry needing to be threadsafe to be shared across sessions. With 
the current impl a new EntityEntry is created for each 
PeristenceContext. If we share it between sessions, there is a race 
condition on the compressedState field, as multiple threads will access 
the same object.

We had discussed about making access to this field threadsafe, or 
removing some of the operations and making the ImmutableEntityEntry 
objects immutable themselves.

I have used a ReadWriteRentrantLock in ImmutableEntityEntry to remove 
the race cond. as this appeared to require least code change, but I am 
uncertain atm what impact this will have on performance as it is in a 
critical section of code. I have not been able to test my changes as we 
currently have an issue with our perf lab after a recent upgrade. I will 
test as soon as I can to see what impact this has on cpu.  This change 
only impacts ImmutableEntityEntry, and not MutableEntityEntry

Thanks

John

-- 
John O'Hara
johara at redhat.com

JBoss, by Red Hat
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom.
Registered in UK and Wales under Company Registration No. 3798903 Directors: Michael Cunningham (USA), Charlie Peters (USA), Matt Parsons (USA) and Michael O'Neill (Ireland).



More information about the hibernate-dev mailing list