[Swift-commit] r4631 - trunk/src/org/griphyn/vdl/mapping
hategan at ci.uchicago.edu
hategan at ci.uchicago.edu
Fri Jun 17 16:27:14 CDT 2011
Author: hategan
Date: 2011-06-17 16:27:14 -0500 (Fri, 17 Jun 2011)
New Revision: 4631
Modified:
trunk/src/org/griphyn/vdl/mapping/AbstractDataNode.java
Log:
fixed deadlock in handle notification
Modified: trunk/src/org/griphyn/vdl/mapping/AbstractDataNode.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/AbstractDataNode.java 2011-06-17 20:23:23 UTC (rev 4630)
+++ trunk/src/org/griphyn/vdl/mapping/AbstractDataNode.java 2011-06-17 21:27:14 UTC (rev 4631)
@@ -400,11 +400,14 @@
}
}
- public synchronized void closeShallow() {
- if (this.closed) {
- return;
+ public void closeShallow() {
+ synchronized(this) {
+ if (this.closed) {
+ return;
+ }
+ this.closed = true;
}
- this.closed = true;
+ // closed
notifyListeners();
if (logger.isInfoEnabled()) {
logger.debug("closed " + this.getIdentifyingString());
@@ -571,18 +574,22 @@
return handles;
}
- public synchronized void addListener(DSHandleListener listener) {
+ public void addListener(DSHandleListener listener) {
if (logger.isDebugEnabled()) {
logger.debug("Adding handle listener \"" + listener +
"\" to \"" + getIdentifyingString() + "\"");
}
- if (listeners == null) {
- listeners = new ArrayList<DSHandleListener>();
+ synchronized(this) {
+ if (listeners == null) {
+ listeners = new ArrayList<DSHandleListener>();
+ }
+ listeners.add(listener);
+ if (!closed) {
+ return;
+ }
}
- listeners.add(listener);
- if (closed) {
- notifyListeners();
- }
+ // listeners != null, closed
+ notifyListeners();
}
protected void notifyListeners() {
More information about the Swift-commit
mailing list