You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2021/02/03 03:32:50 UTC

[GitHub] [skywalking] libinglong commented on a change in pull request #6309: add redefine listener

libinglong commented on a change in pull request #6309:
URL: https://github.com/apache/skywalking/pull/6309#discussion_r569107833



##########
File path: apm-sniffer/apm-agent/src/main/java/org/apache/skywalking/apm/agent/SkyWalkingAgent.java
##########
@@ -215,4 +218,23 @@ public void onError(final String typeName,
         public void onComplete(String typeName, ClassLoader classLoader, JavaModule module, boolean loaded) {
         }
     }
+
+    private static class RedefinitionListener implements AgentBuilder.RedefinitionStrategy.Listener {
+
+        @Override
+        public void onBatch(int index, List<Class<?>> batch, List<Class<?>> types) {
+            /* do nothing */
+        }
+
+        @Override
+        public Iterable<? extends List<Class<?>>> onError(int index, List<Class<?>> batch, Throwable throwable, List<Class<?>> types) {
+            LOGGER.error(throwable, "index={}, batch={}, types={}", index, batch, types);
+            return Collections.emptyList();

Review comment:
       according to the api doc:
   > Returns:
   A set of classes which should be attempted to be redefined. Typically, this should be a subset of the classes contained in batch but not all classes.
   
   We don't need to attempt to redefine again.
   The default listener is net.bytebuddy.agent.builder.AgentBuilder.RedefinitionStrategy.Listener.NoOp.I think adding the error log is enough.
   
   




----------------------------------------------------------------
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:
users@infra.apache.org