Author: medined
Date: Thu Sep 13 04:26:13 2012
New Revision: 1384201
URL: http://svn.apache.org/viewvc?rev=1384201&view=rev
Log:
avoid double checked locking by sychronizing on the method
Modified:
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/conf/Property.java
Modified:
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/conf/Property.java
URL:
http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/conf/Property.java?rev=1384201&r1=1384200&r2=1384201&view=diff
==============================================================================
---
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/conf/Property.java
(original)
+++
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/conf/Property.java
Thu Sep 13 04:26:13 2012
@@ -320,17 +320,14 @@ public enum Property {
private static HashSet<String> validTableProperties = null;
- public static boolean isValidTablePropertyKey(String key) {
- if (validTableProperties == null) {
- synchronized (Property.class) {
- if (validTableProperties == null) {
- HashSet<String> tmp = new HashSet<String>();
- for (Property p : Property.values())
- if (!p.getType().equals(PropertyType.PREFIX) &&
p.getKey().startsWith(Property.TABLE_PREFIX.getKey()))
- tmp.add(p.getKey());
- validTableProperties = tmp;
+ public synchronized static boolean isValidTablePropertyKey(String key) {
+ if (validTableProperties == null) {
+ validTableProperties = new HashSet<String>();
+ for (Property p : Property.values()) {
+ if (!p.getType().equals(PropertyType.PREFIX) &&
p.getKey().startsWith(Property.TABLE_PREFIX.getKey())) {
+ validTableProperties.add(p.getKey());
+ }
}
- }
}
return validTableProperties.contains(key) ||
key.startsWith(Property.TABLE_CONSTRAINT_PREFIX.getKey())