From 43de09873ba47f3c2da2e1fdc3b64cc60eb5bd54 Mon Sep 17 00:00:00 2001 From: Pinaki Poddar Date: Mon, 8 Jun 2009 21:04:00 +0000 Subject: [PATCH] OPENJPA-900: Remove hint key ordering for performance overhead git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@782782 13f79535-47bb-0310-9956-ffa450edef68 --- .../openjpa/persistence/HintHandler.java | 24 ++++--------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/HintHandler.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/HintHandler.java index db7d3152b..d30d8534f 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/HintHandler.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/HintHandler.java @@ -167,7 +167,7 @@ public class HintHandler extends FetchPlanHintHandler { */ public Set getSupportedHints() { if (_supportedKeys == null) { - _supportedKeys = new TreeSet(new HintKeyComparator()); + _supportedKeys = new TreeSet(); _supportedPrefixes = new TreeSet(); _supportedKeys.addAll(Reflection.getFieldValues( @@ -176,7 +176,8 @@ public class HintHandler extends FetchPlanHintHandler { String.class)); _supportedKeys.addAll(addPrefix(PREFIX_FETCHPLAN, - Reflection.getBeanStylePropertyNames(_fConfig.getClass()))); + Reflection.getBeanStylePropertyNames( + owner.getFetchPlan().getClass()))); _supportedKeys.addAll(JavaxHintsMap.keySet()); @@ -284,24 +285,6 @@ public class HintHandler extends FetchPlanHintHandler { return objectSet; } - public static class HintKeyComparator implements Comparator { - public int compare(String s1, String s2) { - if (getPrefixOf(s1).equals(getPrefixOf(s2))) { - int n1 = countDots(s1); - int n2 = countDots(s2); - return (n1 == n2) ? s1.compareTo(s2) : (n1 - n2); - } else - return s1.compareTo(s2); - } - - public int countDots(String s) { - if (s == null || s.length() == 0) - return 0; - int index = s.indexOf(DOT); - return (index == -1) ? 0 : countDots(s.substring(index + 1)) + 1; - } - } - protected String hintToKey(String key) { // Let superclass performs key transformation when fPlan.setHint() // is called. @@ -316,3 +299,4 @@ public class HintHandler extends FetchPlanHintHandler { return result; } } +