You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@asterixdb.apache.org by "Murtadha Hubail (Code Review)" <do...@asterixdb.incubator.apache.org> on 2016/06/28 20:58:38 UTC

Change in asterixdb[master]: ASTERIXDB-1497: Prevent ConcurrentModification in DefaultDea...

Murtadha Hubail has uploaded a new change for review.

  https://asterix-gerrit.ics.uci.edu/965

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
---
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(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/65/965/1

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: newchange
Gerrit-Change-Id: I1189d74ca33cbe8abf5b964eb8ff334df03c4004
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Murtadha Hubail <hu...@gmail.com>

Change in asterixdb[master]: ASTERIXDB-1497: Prevent ConcurrentModification in DefaultDea...

Posted by "Murtadha Hubail (Code Review)" <do...@asterixdb.incubator.apache.org>.
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 <je...@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
Reviewed-by: Michael Blow <mi...@couchbase.com>
---
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 <hu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Michael Blow <mi...@couchbase.com>
Gerrit-Reviewer: Murtadha Hubail <hu...@gmail.com>

Change in asterixdb[master]: ASTERIXDB-1497: Prevent ConcurrentModification in DefaultDea...

Posted by "Jenkins (Code Review)" <do...@asterixdb.incubator.apache.org>.
Jenkins has posted comments on this change.

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


Patch Set 1:

Build Started https://asterix-jenkins.ics.uci.edu/job/asterix-gerrit-notopic/1763/

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I1189d74ca33cbe8abf5b964eb8ff334df03c4004
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Murtadha Hubail <hu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-HasComments: No

Change in asterixdb[master]: ASTERIXDB-1497: Prevent ConcurrentModification in DefaultDea...

Posted by "Michael Blow (Code Review)" <do...@asterixdb.incubator.apache.org>.
Michael Blow has posted comments on this change.

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


Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I1189d74ca33cbe8abf5b964eb8ff334df03c4004
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Murtadha Hubail <hu...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Michael Blow <mi...@couchbase.com>
Gerrit-HasComments: No