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 <[email protected]>