symat commented on a change in pull request #1407:
URL: https://github.com/apache/zookeeper/pull/1407#discussion_r459452127
##########
File path: zookeeper-server/src/main/java/org/apache/zookeeper/ClientCnxn.java
##########
@@ -469,6 +470,16 @@ private static String makeThreadName(String suffix) {
return name + suffix;
}
+ /**
+ * Tests that current thread is the main event loop.
+ * This method is useful only for tests inside ZooKeeper project
+ * it is not a public API intended for use by external applications.
+ * @return true if Thread.currentThread() is an EventThread.
+ */
+ public static boolean isInEventThread() {
Review comment:
Usually I try to avoid adding anything to the code "just for the tests".
On the other hand this method can be even handy when the users are writing
their own callbacks. Or for other unit tests. And the EventThread is an
inner-class, so I wouldn't expose it either...
So all-in-all I think this is a meaningful change, let's keep it.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]