fix ConcurrentModificationException
authorDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Mon, 12 May 2008 21:49:12 +0000 (21:49 +0000)
committerDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Mon, 12 May 2008 21:49:12 +0000 (21:49 +0000)
git-svn-id: http://trooper/svn/projects/jFCPlib/branch/high-level-client@854 c3eda9e8-030b-0410-8277-bc7414b0a119

src/net/pterodactylus/fcp/highlevel/HighLevelCallback.java

index ac448a6..541e502 100644 (file)
@@ -84,15 +84,17 @@ public class HighLevelCallback<R extends HighLevelResult> {
        }
 
        /**
-        * Notifies all listeners that the result of the operation is now known.
+        * Notifies all listeners that the result of the operation is now known. As
+        * soon as a listener was notified it will be removed from the list of
+        * listeners!
         * 
         * @see HighLevelCallbackListener#gotResult(HighLevelCallback)
         */
        private synchronized void fireGotResult() {
                for (HighLevelCallbackListener<R> highLevelCallbackListener: highLevelCallbackListeners) {
-                       highLevelCallbackListeners.remove(highLevelCallbackListener);
                        highLevelCallbackListener.gotResult(this);
                }
+               highLevelCallbackListeners.clear();
        }
 
        /**