Author: jm
Date: 2012-07-04 13:19:27 -0700 (Wed, 04 Jul 2012)
New Revision: 29755
Modified:
core3/impl/trunk/event-impl/impl/src/main/java/org/cytoscape/event/internal/CyEventHelperImpl.java
Log:
Fixes #1181: Fixed memory leak in CyEventHelperImpl.sourceAccMap
Modified:
core3/impl/trunk/event-impl/impl/src/main/java/org/cytoscape/event/internal/CyEventHelperImpl.java
===================================================================
---
core3/impl/trunk/event-impl/impl/src/main/java/org/cytoscape/event/internal/CyEventHelperImpl.java
2012-07-04 18:45:49 UTC (rev 29754)
+++
core3/impl/trunk/event-impl/impl/src/main/java/org/cytoscape/event/internal/CyEventHelperImpl.java
2012-07-04 20:19:27 UTC (rev 29755)
@@ -39,9 +39,11 @@
import org.cytoscape.event.CyEventHelper;
import java.util.ArrayList;
+import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.WeakHashMap;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.Executors;
@@ -155,8 +157,11 @@
flushList = new ArrayList<CyPayloadEvent<?,?>>();
havePayload = false;
- for ( Object source : sourceAccMap.keySet() ) {
- for ( PayloadAccumulator<?,?,?> acc :
sourceAccMap.get(source).values() ) {
+ Iterator<Entry<Object, Map<Class<?>,
PayloadAccumulator<?, ?, ?>>>> iterator = sourceAccMap.entrySet().iterator();
+ while (iterator.hasNext()) {
+ Entry<Object, Map<Class<?>,
PayloadAccumulator<?, ?, ?>>> entry = iterator.next();
+ Object source = entry.getKey();
+ for ( PayloadAccumulator<?,?,?> acc :
entry.getValue().values() ) {
try {
CyPayloadEvent<?,?> event =
acc.newEventInstance( source );
if ( event != null ) {
@@ -166,6 +171,7 @@
logger.warn("Couldn't
instantiate event for source: " + source, ie);
}
}
+ iterator.remove();
}
}
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.