-
Notifications
You must be signed in to change notification settings - Fork 274
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
Use MethodHandles to access AWS Request metadata #2655
Conversation
c028c8a
to
eff6ee0
Compare
eff6ee0
to
f42ef66
Compare
...on/aws-java-sdk-1.11.0/src/main/java/datadog/trace/instrumentation/aws/v0/RequestAccess.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much better solution.
...ava-sdk-1.11.0/src/main/java/datadog/trace/instrumentation/aws/v0/AwsSdkClientDecorator.java
Outdated
Show resolved
Hide resolved
f42ef66
to
ea041d5
Compare
private static final ClassValue<RequestAccess> REQUEST_ACCESS = | ||
new ClassValue<RequestAccess>() { | ||
@Override | ||
protected RequestAccess computeValue(final Class<?> requestType) { | ||
return new RequestAccess(requestType); | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I consolidated these in to GenericClassValue
last week, so that you could write
private static final ClassValue<RequestAccess> REQUEST_ACCESS =
GenericClassValue.of(new Function<Class<?>, RequestAccess>() {
@Override
public RequestAccess apply(final Class<?> requestType) {
return new RequestAccess(requestType);
}
});
and optionally factor out a function to construct an instance from a class parameter and drop the helper class, or
private static final ClassValue<RequestAccess> REQUEST_ACCESS = GenericClassValue.of(RequestAccess::new);
and drop the helper class when we drop JDK7.
Reduces the need to maintain a side-table of metadata by using method handles to access named (public) getters.