incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject git commit: Fixing threading issue where the system became unresponive due to an issue with using a hashmap in the table descriptor object.
Date Tue, 03 Mar 2015 14:06:38 GMT
Repository: incubator-blur
Updated Branches:
  refs/heads/master 4744b91ef -> aeb3623da


Fixing threading issue where the system became unresponive due to an issue with using a hashmap
in the table descriptor object.


Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/aeb3623d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/aeb3623d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/aeb3623d

Branch: refs/heads/master
Commit: aeb3623daf08d54731c00a9dbfdb116c3973e59d
Parents: 4744b91
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Tue Mar 3 09:06:20 2015 -0500
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Tue Mar 3 09:06:20 2015 -0500

----------------------------------------------------------------------
 .../org/apache/blur/server/TableContext.java    | 26 ++++++++++++++++----
 1 file changed, 21 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/aeb3623d/blur-core/src/main/java/org/apache/blur/server/TableContext.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/server/TableContext.java b/blur-core/src/main/java/org/apache/blur/server/TableContext.java
index 7f98a77..6fcf573 100644
--- a/blur-core/src/main/java/org/apache/blur/server/TableContext.java
+++ b/blur-core/src/main/java/org/apache/blur/server/TableContext.java
@@ -142,12 +142,28 @@ public class TableContext implements Cloneable {
     }
     TableContext tableContext = _cache.get(name);
     if (tableContext != null) {
-      TableContext clone = tableContext.clone();
-      TableDescriptor newTd = new TableDescriptor(clone._descriptor);
-      clone._descriptor = newTd;
-      clone._descriptor.setEnabled(tableDescriptor.isEnabled());
-      return clone;
+      return clone(tableDescriptor, tableContext);
     }
+    synchronized (_cache) {
+      tableContext = _cache.get(name);
+      if (tableContext != null) {
+        return clone(tableDescriptor, tableContext);
+      }
+      return createInternal(tableDescriptor, remote, client, name, tableUri);
+    }
+  }
+
+  private static TableContext clone(TableDescriptor tableDescriptor, TableContext tableContext)
{
+    TableContext clone = tableContext.clone();
+    TableDescriptor newTd = new TableDescriptor(clone._descriptor);
+    clone._descriptor = newTd;
+    clone._descriptor.setEnabled(tableDescriptor.isEnabled());
+    return clone;
+  }
+
+  private static TableContext createInternal(TableDescriptor tableDescriptor, boolean remote,
Iface client,
+      String name, String tableUri) {
+    TableContext tableContext;
     LOG.info("Creating table context for table [{0}]", name);
     Configuration configuration = getSystemConfiguration();
     BlurConfiguration blurConfiguration = getSystemBlurConfiguration();


Mime
View raw message