Liran Zelkha has posted comments on this change.

Change subject: engine: Hibernate PersistentCollections
......................................................................


Patch Set 1:

(1 comment)

https://gerrit.ovirt.org/#/c/41810/1/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/server/gwt/hibernate/HibernateCleaner.java
File 
frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/server/gwt/hibernate/HibernateCleaner.java:

Line 42:             return dirty;
Line 43:         }
Line 44: 
Line 45:         if (!processCollections(dirty, processed)) {
Line 46:             for (String getterName : 
ReflectionUtils.getGetterNames(dirty)) {
> Actually this is the part that loops over all the getters in all the object
I think we can have the following logic:
1. If the object has the @Entity annotation - only then run this reflection (as 
otherwise it's not an Hibernate object). This Map can be stored in cache, as 
the number of classes is finite (and I guess the count is lower than 1000).
2. If it is an Entity (up to 100 objects), store the list of getter methods in 
cache. We should store the Method object, not the method name.

This will minimize the reflection API usage, and make this code run much much 
faster, while using low amount of memory (I would guess less than 1MB)
Line 47:                 Object object = ReflectionUtils.get(dirty, getterName);
Line 48:                 if (object instanceof AbstractPersistentCollection) {
Line 49:                     // Hibernate persistent class, replace the 
implementation.
Line 50:                     ReflectionUtils.setIfPossible(dirty, getterName, 
doHibernateClean(object, processed));


-- 
To view, visit https://gerrit.ovirt.org/41810
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I4eac0864e844ad8e1885134df69f976c784b3960
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Alexander Wels <aw...@redhat.com>
Gerrit-Reviewer: Alexander Wels <aw...@redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Liran Zelkha <lzel...@redhat.com>
Gerrit-Reviewer: Tomas Jelinek <tjeli...@redhat.com>
Gerrit-Reviewer: automat...@ovirt.org
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to