summaryrefslogtreecommitdiff
path: root/java/client/src/main/java/org/apache
diff options
context:
space:
mode:
authorRajith Muditha Attapattu <rajith@apache.org>2011-06-22 03:40:03 +0000
committerRajith Muditha Attapattu <rajith@apache.org>2011-06-22 03:40:03 +0000
commit7c56930df8226296958d5632e336e439b5b7c661 (patch)
tree5c68952e1adf660501845c5623297a7ab3d3d3d3 /java/client/src/main/java/org/apache
parent50f2b60a98544606d2e20da8e211d04a959831ee (diff)
downloadqpid-python-7c56930df8226296958d5632e336e439b5b7c661.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/qpid@1138296 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/client/src/main/java/org/apache')
-rw-r--r--java/client/src/main/java/org/apache/qpid/client/CustomJMSXProperty.java29
1 files changed, 15 insertions, 14 deletions
diff --git a/java/client/src/main/java/org/apache/qpid/client/CustomJMSXProperty.java b/java/client/src/main/java/org/apache/qpid/client/CustomJMSXProperty.java
index 7cc548915c..e81e754da2 100644
--- a/java/client/src/main/java/org/apache/qpid/client/CustomJMSXProperty.java
+++ b/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);
}
}