novitski / bitcoinj

Automatically exported from code.google.com/p/bitcoinj
Apache License 2.0
0 stars 0 forks source link

Show event listeners #355

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
commit 6cb7cb421ef5ce2fec6bdbed311a8c005bb4f930 (HEAD, 
refs/remotes/kens-googlecode/kens2, refs/heads/kens2)
Date:   Mon Mar 18 09:45:50 2013 -0700

    Show peer event listeners, for debugging (i.e. duplicate event listeners).

    Modified   core/src/main/java/com/google/bitcoin/core/Peer.java
diff --git a/core/src/main/java/com/google/bitcoin/core/Peer.java 
b/core/src/main/java/com/google/bitcoin/core/Peer.java
index 5aa0d57..b82bc03 100644
--- a/core/src/main/java/com/google/bitcoin/core/Peer.java
+++ b/core/src/main/java/com/google/bitcoin/core/Peer.java
@@ -175,6 +175,11 @@ public class Peer {
         return eventListeners.remove(listener);
     }

+    public CopyOnWriteArrayList<PeerEventListener> getEventListeners() {
+        return eventListeners;
+    }
+
+
     void addLifecycleListener(PeerLifecycleListener listener) {
         lifecycleListeners.add(listener);
     }

Original issue reported on code.google.com by k...@bamfic.com on 18 Mar 2013 at 4:49

GoogleCodeExporter commented 9 years ago
I'm not sure it makes sense to have public APIs just for debugging stuff like 
that. It'd be better to print a warning if you add a duplicate event listener. 
But it would be hard to catch the case of inner classes.

Original comment by hearn@google.com on 18 Mar 2013 at 5:08