-
Notifications
You must be signed in to change notification settings - Fork 867
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use VirtualField for associating netty listener with wrapper (#5282)
* Use VirtualField for associating netty listener with wrapper * Move ignoring lambas for injected classes to LambdaTransformer
- Loading branch information
Showing
4 changed files
with
57 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...strap/src/main/java/io/opentelemetry/javaagent/bootstrap/InjectedHelperClassDetector.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.javaagent.bootstrap; | ||
|
||
import java.util.function.Function; | ||
|
||
/** Helper class for detecting whether given class is an injected helper class. */ | ||
public final class InjectedHelperClassDetector { | ||
|
||
private InjectedHelperClassDetector() {} | ||
|
||
private static volatile Function<Class<?>, Boolean> helperClassDetector; | ||
|
||
/** Sets the {@link Function} for detecting injected helper classes. */ | ||
public static void internalSetHelperClassDetector( | ||
Function<Class<?>, Boolean> helperClassDetector) { | ||
if (InjectedHelperClassDetector.helperClassDetector != null) { | ||
// Only possible by misuse of this API, just ignore. | ||
return; | ||
} | ||
InjectedHelperClassDetector.helperClassDetector = helperClassDetector; | ||
} | ||
|
||
public static boolean isHelperClass(Class<?> clazz) { | ||
if (helperClassDetector == null) { | ||
return false; | ||
} | ||
return helperClassDetector.apply(clazz); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters