Liran Zelkha has posted comments on this change. Change subject: engine: Hibernate PersistentCollections ......................................................................
Patch Set 1: (4 comments) 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)) { Can we cache all the results of the reflection code here? After all, we'll have a limited number of classes that are Hibernate related (so cache size will be small), and storing this reflection code can greatly improve our performance. 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)); https://gerrit.ovirt.org/#/c/41810/1/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/server/gwt/hibernate/ReflectionUtils.java File frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/server/gwt/hibernate/ReflectionUtils.java: Line 15: } Line 16: return properties; Line 17: } Line 18: Line 19: private static boolean isGetter(Method method) { Can be cached Line 20: String name = method.getName(); Line 21: if (!name.startsWith("get")) //$NON-NLS-1$ Line 22: return false; Line 23: if (name.length() == 3) Line 34: @SuppressWarnings("unchecked") Line 35: public static <T> T get(Object object, String methodName) { Line 36: try { Line 37: Class<? extends Object> xClass = object.getClass(); Line 38: Method method = xClass.getMethod(methodName); Cache Line 39: return (T) method.invoke(object); Line 40: } catch (Exception e) { Line 41: throw new RuntimeException(e); Line 42: } Line 56: } Line 57: } Line 58: Line 59: private static Method getMethod(Class<?> Clazz, String name) { Line 60: Method[] methods = Clazz.getMethods(); Cache Line 61: for (Method method : methods) { Line 62: if (method.getName().equals(name)) Line 63: return method; Line 64: } -- 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: 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