accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [43/50] [abbrv] accumulo git commit: ACCUMULO-3372 merge 1.6 to master
Date Tue, 02 Dec 2014 20:37:31 GMT
ACCUMULO-3372 merge 1.6 to master


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/191bee18
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/191bee18
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/191bee18

Branch: refs/heads/metrics2
Commit: 191bee18078e90f9d7d465c04142e4612404c9f9
Parents: 211197c 7f20e6a
Author: Eric C. Newton <eric.newton@gmail.com>
Authored: Mon Dec 1 12:35:49 2014 -0500
Committer: Eric C. Newton <eric.newton@gmail.com>
Committed: Mon Dec 1 12:35:49 2014 -0500

----------------------------------------------------------------------
 .../server/conf/ServerConfigurationFactory.java | 51 +++++++++++++-------
 1 file changed, 33 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/191bee18/server/base/src/main/java/org/apache/accumulo/server/conf/ServerConfigurationFactory.java
----------------------------------------------------------------------
diff --cc server/base/src/main/java/org/apache/accumulo/server/conf/ServerConfigurationFactory.java
index 8bcb5a7,35b6556..128f74e
--- a/server/base/src/main/java/org/apache/accumulo/server/conf/ServerConfigurationFactory.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/conf/ServerConfigurationFactory.java
@@@ -147,56 -146,67 +147,71 @@@ public class ServerConfigurationFactor
      return systemConfig;
    }
  
 +  @Override
    public TableConfiguration getTableConfiguration(String tableId) {
      checkPermissions();
+     TableConfiguration conf;
      synchronized (tableConfigs) {
-       TableConfiguration conf = tableConfigs.get(instanceID).get(tableId);
-       if (conf == null && Tables.exists(instance, tableId)) {
+       conf = tableConfigs.get(instanceID).get(tableId);
+     }
+     // can't hold the lock during the construction and validation of the config, 
+     // which may result in creating multiple objects for the same id, but that's ok.
+     if (conf == null && Tables.exists(instance, tableId)) {
 -      conf = new TableConfiguration(instance.getInstanceID(), tableId, getNamespaceConfigurationForTable(tableId));
 -      ConfigSanityCheck.validate(conf);
 -      synchronized (tableConfigs) {
 -        tableConfigs.get(instanceID).put(tableId, conf);
 -      }
 +        conf = new TableConfiguration(instance, tableId, getNamespaceConfigurationForTable(tableId));
 +        ConfigSanityCheck.validate(conf);
-         tableConfigs.get(instanceID).put(tableId, conf);
-       }
-       return conf;
++        synchronized (tableConfigs) {
++          tableConfigs.get(instanceID).put(tableId, conf);
++        }
      }
+     return conf;
    }
  
 +  @Override
    public TableConfiguration getTableConfiguration(KeyExtent extent) {
      return getTableConfiguration(extent.getTableId().toString());
    }
  
    public NamespaceConfiguration getNamespaceConfigurationForTable(String tableId) {
      checkPermissions();
+     NamespaceConfiguration conf;
      synchronized (tableParentConfigs) {
-       NamespaceConfiguration conf = tableParentConfigs.get(instanceID).get(tableId);
-       if (conf == null) {
-         // changed - include instance in constructor call
-         conf = new TableParentConfiguration(tableId, instance, getConfiguration());
-         ConfigSanityCheck.validate(conf);
+       conf = tableParentConfigs.get(instanceID).get(tableId);
+     }
+     // can't hold the lock during the construction and validation of the config, 
+     // which may result in creating multiple objects for the same id, but that's ok.
+     if (conf == null) {
+       // changed - include instance in constructor call
+       conf = new TableParentConfiguration(tableId, instance, getConfiguration());
+       ConfigSanityCheck.validate(conf);
+       synchronized (tableParentConfigs) {
          tableParentConfigs.get(instanceID).put(tableId, conf);
        }
-       return conf;
      }
+     return conf;
    }
  
 +  @Override
    public NamespaceConfiguration getNamespaceConfiguration(String namespaceId) {
      checkPermissions();
+     NamespaceConfiguration conf;
+     // can't hold the lock during the construction and validation of the config, 
+     // which may result in creating multiple objects for the same id, but that's ok.
      synchronized (namespaceConfigs) {
-       NamespaceConfiguration conf = namespaceConfigs.get(instanceID).get(namespaceId);
-       if (conf == null) {
-         // changed - include instance in constructor call
-         conf = new NamespaceConfiguration(namespaceId, instance, getConfiguration());
-         conf.setZooCacheFactory(zcf);
-         ConfigSanityCheck.validate(conf);
+       conf = namespaceConfigs.get(instanceID).get(namespaceId);
+     }
+     if (conf == null) {
+       // changed - include instance in constructor call
+       conf = new NamespaceConfiguration(namespaceId, instance, getConfiguration());
+       conf.setZooCacheFactory(zcf);
+       ConfigSanityCheck.validate(conf);
+       synchronized (namespaceConfigs) {
          namespaceConfigs.get(instanceID).put(namespaceId, conf);
        }
-       return conf;
      }
+     return conf;
    }
  
 +  @Override
    public Instance getInstance() {
      return instance;
    }


Mime
View raw message