-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[GR-50962] Add object reachability hooks. #8041
Conversation
df22748
to
ba32dfe
Compare
|
@kkriske Do you have a concrete use case where you need this as public API. For now, we left it internal so that we can evolved and test it. We are also not sure how it will interact with layered images. But if there is a good external use case, we can consider making it supported API. |
@christianwimmer In general cases where static objects need some additional work to trigger lazy loading of e.g. classes from files. class Util {
public static final ClassHolder EXAMPLE_CLASS = new ClassHolder("org.example.Example");
}
class ClassHolder {
private final String className;
private Class<?> classValue;
public ClassHolder(String className) {
this.className = className;
}
public Class<?> getClassValue() {
if (classValue == null) {
try {
classValue = Class.forName(className);
} catch (ClassNotFoundException e) {
classValue = Object.class;
}
}
return classValue;
}
} What we currently do, is initialize the I've now realized it would be easier to use object replacers, but then the We have multiple similar, and more complex usecases, mostly aimed at reducing the need of reflection and/or resource config, because manual config, or even automated collection with the agent, is unfeasable. PS: same person as @kkriske, but on this account I have access to the relevant resources. |
No description provided.