diff options
Diffstat (limited to 'qpid/java/client/src/main/java/org/apache/qpid/client/CustomJMSXProperty.java')
-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); } } |