diff options
author | Rajith Muditha Attapattu <rajith@apache.org> | 2011-06-22 03:40:03 +0000 |
---|---|---|
committer | Rajith Muditha Attapattu <rajith@apache.org> | 2011-06-22 03:40:03 +0000 |
commit | 905f1a8753ec8eadea753cf663e1e709568a33fc (patch) | |
tree | c0193d1488403c6bc6ccbb4bebc49a0781f83164 | |
parent | d3e9c13f31ece9e288e8a23df350f851c327ab17 (diff) | |
download | qpid-python-905f1a8753ec8eadea753cf663e1e709568a33fc.tar.gz |
QPID-3270 A new enumeration is created off a static list for each
invocation of asEnumeration().
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1138296 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | qpid/java/client/src/main/java/org/apache/qpid/client/CustomJMSXProperty.java | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/CustomJMSXProperty.java b/qpid/java/client/src/main/java/org/apache/qpid/client/CustomJMSXProperty.java index 7cc548915c..e81e754da2 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/CustomJMSXProperty.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/CustomJMSXProperty.java @@ -23,6 +23,7 @@ package org.apache.qpid.client; import java.util.ArrayList; import java.util.Collections; import java.util.Enumeration; +import java.util.List; import org.apache.qpid.framing.AMQShortString; @@ -34,6 +35,18 @@ public enum CustomJMSXProperty JMSXGroupSeq, JMSXUserID; + private static List<String> _names; + + static + { + CustomJMSXProperty[] properties = values(); + _names = new ArrayList<String>(properties.length); + for(CustomJMSXProperty property : properties) + { + _names.add(property.toString()); + } + + } private final AMQShortString _nameAsShortString; @@ -47,20 +60,8 @@ public enum CustomJMSXProperty return _nameAsShortString; } - private static Enumeration _names; - - public static synchronized Enumeration asEnumeration() + public static Enumeration asEnumeration() { - if(_names == null) - { - CustomJMSXProperty[] properties = values(); - ArrayList<String> nameList = new ArrayList<String>(properties.length); - for(CustomJMSXProperty property : properties) - { - nameList.add(property.toString()); - } - _names = Collections.enumeration(nameList); - } - return _names; + return Collections.enumeration(_names); } } |