You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by mh...@apache.org on 2016/06/28 22:45:02 UTC

asterixdb git commit: ASTERIXDB-1497: Prevent ConcurrentModification in DefaultDeallocatableRegistry

Repository: asterixdb
Updated Branches:
  refs/heads/master 09a764458 -> ccdd80b0c


ASTERIXDB-1497: Prevent ConcurrentModification in DefaultDeallocatableRegistry

This change prevents the possible ConcurrentModificationException
in DefaultDeallocatableRegistry.

Change-Id: I1189d74ca33cbe8abf5b964eb8ff334df03c4004
Reviewed-on: https://asterix-gerrit.ics.uci.edu/965
Reviewed-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
Reviewed-by: Michael Blow <mi...@couchbase.com>


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

Branch: refs/heads/master
Commit: ccdd80b0c10911972b8175ad907374a1133dc1ef
Parents: 09a7644
Author: Murtadha Hubail <mh...@uci.edu>
Authored: Tue Jun 28 23:30:59 2016 +0300
Committer: Murtadha Hubail <hu...@gmail.com>
Committed: Tue Jun 28 15:44:26 2016 -0700

----------------------------------------------------------------------
 .../nc/resources/DefaultDeallocatableRegistry.java  | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ccdd80b0/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/resources/DefaultDeallocatableRegistry.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/resources/DefaultDeallocatableRegistry.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/resources/DefaultDeallocatableRegistry.java
index d491836..d1ae8f3 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/resources/DefaultDeallocatableRegistry.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/resources/DefaultDeallocatableRegistry.java
@@ -18,8 +18,8 @@
  */
 package org.apache.hyracks.control.nc.resources;
 
+import java.util.ArrayList;
 import java.util.List;
-import java.util.Vector;
 
 import org.apache.hyracks.api.resources.IDeallocatable;
 import org.apache.hyracks.api.resources.IDeallocatableRegistry;
@@ -28,21 +28,17 @@ public class DefaultDeallocatableRegistry implements IDeallocatableRegistry {
     private final List<IDeallocatable> deallocatables;
 
     public DefaultDeallocatableRegistry() {
-        deallocatables = new Vector<IDeallocatable>();
+        deallocatables = new ArrayList<>();
     }
 
     @Override
-    public void registerDeallocatable(IDeallocatable deallocatable) {
+    public synchronized void registerDeallocatable(IDeallocatable deallocatable) {
         deallocatables.add(deallocatable);
     }
 
-    public void close() {
+    public synchronized void close() {
         for (IDeallocatable d : deallocatables) {
-            try {
-                d.deallocate();
-            } catch (Exception e) {
-                // ignore
-            }
+            d.deallocate();
         }
     }
-}
+}
\ No newline at end of file