Murtadha Hubail has submitted this change and it was merged.

Change subject: ASTERIXDB-1497: Prevent ConcurrentModification in 
DefaultDeallocatableRegistry
......................................................................


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 <[email protected]>
Tested-by: Jenkins <[email protected]>
Reviewed-by: Michael Blow <[email protected]>
---
M 
hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/resources/DefaultDeallocatableRegistry.java
1 file changed, 6 insertions(+), 10 deletions(-)

Approvals:
  Michael Blow: Looks good to me, approved
  Jenkins: Looks good to me, but someone else must approve; Verified



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 @@
     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

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/965
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I1189d74ca33cbe8abf5b964eb8ff334df03c4004
Gerrit-PatchSet: 2
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Murtadha Hubail <[email protected]>
Gerrit-Reviewer: Jenkins <[email protected]>
Gerrit-Reviewer: Michael Blow <[email protected]>
Gerrit-Reviewer: Murtadha Hubail <[email protected]>

Reply via email to