[hibernate-commits] [hibernate/hibernate-orm] 194518: HHH-12791 Cache the Component type to avoid genera...

GitHub noreply at github.com
Thu Jul 19 04:02:10 EDT 2018


  Branch: refs/heads/5.3
  Home:   https://github.com/hibernate/hibernate-orm
  Commit: 1945180569e7f86f8b5633418c5a1af42db3c8e2
      https://github.com/hibernate/hibernate-orm/commit/1945180569e7f86f8b5633418c5a1af42db3c8e2
  Author: Guillaume Smet <guillaume.smet at gmail.com>
  Date:   2018-07-19 (Thu, 19 Jul 2018)

  Changed paths:
    M hibernate-core/src/main/java/org/hibernate/mapping/Component.java
    M hibernate-core/src/test/java/org/hibernate/test/component/proxy/ComponentBasicProxyTest.java

  Log Message:
  -----------
  HHH-12791 Cache the Component type to avoid generating one proxy per call

While Javassist only generates one proxy as the name is stable,
ByteBuddy uses random names and thus generates a new proxy for every
call, leading to the generation of 18 different proxies for the other
test of the test class.

We can't do better than using a volatile/synchronized pattern as the
Component is not fully initialized in the constructor.

Maybe we could take the risk of admitting that the getType() method is
called at least once before we pass the element to a multi-threaded
environment but that's a bet I don't want to take alone.



      **NOTE:** This service been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/

      Functionality will be removed from GitHub.com on January 31st, 2019.


More information about the hibernate-commits mailing list