damccorm commented on code in PR #41013:
URL: https://github.com/apache/beam/pull/41013#discussion_r4556472991
##########
sdks/java/io/jms/src/main/java/org/apache/beam/sdk/io/jms/JmsIO.java:
##########
@@ -633,6 +633,34 @@ public interface MessageMapper<T> extends Serializable {
T mapMessage(Message message) throws Exception;
}
+ /** The first stack frames outside JmsIO, to tell which runner code path
calls the reader. */
+ private static String callerOutsideJmsIO() {
+ String jmsPackage = JmsIO.class.getName().substring(0,
JmsIO.class.getName().lastIndexOf('.'));
+ StringBuilder caller = new StringBuilder();
+ int frames = 0;
+ for (StackTraceElement frame : new Throwable().getStackTrace()) {
+ if (frame.getClassName().startsWith(jmsPackage)) {
+ continue;
+ }
+ if (frames > 0) {
+ caller.append(" <- ");
+ }
+
caller.append(frame.getClassName()).append('.').append(frame.getMethodName());
+ if (++frames == 3) {
+ break;
+ }
+ }
+ return caller.toString();
Review Comment:
Nit: Since this only runs when `LOG.isDebugEnabled()`, `new
Throwable().getStackTrace()` is fine, though `StackWalker.getInstance()` avoids
materializing the full stack trace array if `DEBUG` logging is enabled on a
busy worker.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]