[Swift-commit] r7098 - trunk/src/org/griphyn/vdl/mapping
hategan at ci.uchicago.edu
hategan at ci.uchicago.edu
Sat Sep 21 23:05:35 CDT 2013
Author: hategan
Date: 2013-09-21 23:05:35 -0500 (Sat, 21 Sep 2013)
New Revision: 7098
Modified:
trunk/src/org/griphyn/vdl/mapping/AbstractDataNode.java
trunk/src/org/griphyn/vdl/mapping/ArrayDataNode.java
Log:
fixed self closing race condition and lockup
Modified: trunk/src/org/griphyn/vdl/mapping/AbstractDataNode.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/AbstractDataNode.java 2013-09-22 04:05:10 UTC (rev 7097)
+++ trunk/src/org/griphyn/vdl/mapping/AbstractDataNode.java 2013-09-22 04:05:35 UTC (rev 7098)
@@ -732,16 +732,20 @@
boolean closed;
WaitingThreadsMonitor.addThread(l, this);
synchronized(this) {
- if (this.listeners == null) {
- this.listeners = new ArrayList<FutureListener>();
- }
- this.listeners.add(l);
- closed = this.closed;
+ closed = addListener0(l);
}
if (closed) {
notifyListeners();
}
}
+
+ protected boolean addListener0(FutureListener l) {
+ if (this.listeners == null) {
+ this.listeners = new ArrayList<FutureListener>();
+ }
+ this.listeners.add(l);
+ return this.closed;
+ }
protected void notifyListeners() {
List<FutureListener> l;
Modified: trunk/src/org/griphyn/vdl/mapping/ArrayDataNode.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/ArrayDataNode.java 2013-09-22 04:05:10 UTC (rev 7097)
+++ trunk/src/org/griphyn/vdl/mapping/ArrayDataNode.java 2013-09-22 04:05:35 UTC (rev 7098)
@@ -24,7 +24,10 @@
import java.util.List;
import java.util.Map;
+import k.rt.FutureListener;
+
import org.globus.cog.karajan.futures.FutureNotYetAvailable;
+import org.griphyn.vdl.karajan.WaitingThreadsMonitor;
import org.griphyn.vdl.type.Field;
public class ArrayDataNode extends DataNode {
@@ -101,6 +104,21 @@
}
@Override
+ public void addListener(FutureListener l) {
+ boolean shouldNotify;
+ WaitingThreadsMonitor.addThread(l, this);
+ synchronized(this) {
+ shouldNotify = addListener0(l);
+ if (keyList != null) {
+ shouldNotify = true;
+ }
+ }
+ if (shouldNotify) {
+ notifyListeners();
+ }
+ }
+
+ @Override
public synchronized DSHandle createField(Comparable<?> key) throws NoSuchFieldException {
DSHandle h = super.createField(key);
addKey(key);
More information about the Swift-commit
mailing list