Alexander Wels has posted comments on this change. Change subject: restapi: optimize getUriBuilder ......................................................................
Patch Set 2: (1 comment) http://gerrit.ovirt.org/#/c/37988/2/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/utils/LinkHelper.java File backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/utils/LinkHelper.java: Line 813: Collection collection = getCollection(model, suggestedParentType); Line 814: if (collection == null) { Line 815: return null; Line 816: } Line 817: UriBuilder uriBuilder = builderMap.get(collection); > Using the collection as the key of the map improves the situation. But I st I will implement the equals and hashcode methods. In regards to 2. You will notice below that when creating the builder that goes into the cache, I actually put a clone of the just constructed builder in the cache BEFORE I call set path on the original. So the clone is an 'empty' version of the builder. Also when retrieving the builder from the cache, I call clone again before populating the clone. So in both cases the cached version does not contain any specific model information, just the information to build the path. This was done mainly for concurrency concerns (what happens when 2 threads try to modify the same object at the same time, nothing right now as both threads will have a copy). Line 818: Line 819: if (uriBuilder == null) { Line 820: Line 821: if (collection.getParentType() != NO_PARENT) { -- To view, visit http://gerrit.ovirt.org/37988 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I86221e8af24da28a7137c0cc0e7aec69943a65c5 Gerrit-PatchSet: 2 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Alexander Wels <aw...@redhat.com> Gerrit-Reviewer: Alexander Wels <aw...@redhat.com> Gerrit-Reviewer: Einav Cohen <eco...@redhat.com> Gerrit-Reviewer: Juan Hernandez <juan.hernan...@redhat.com> Gerrit-Reviewer: automat...@ovirt.org Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches