Skip to content

Commit

Permalink
Refactored AWSXRayServletFilter - not to use deprecated method for st…
Browse files Browse the repository at this point in the history
…rategy creation (#386)

Co-authored-by: Evgeniy Sokolov <[email protected]>
  • Loading branch information
eugine and EvgeniySokolov authored Jul 17, 2023
1 parent f81966d commit babdde3
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public AWSXRayServletFilter() {
}

public AWSXRayServletFilter(String fixedSegmentName) {
this(new FixedSegmentNamingStrategy(fixedSegmentName));
this(SegmentNamingStrategy.fixed(fixedSegmentName));
}

public AWSXRayServletFilter(@Nullable SegmentNamingStrategy segmentNamingStrategy) {
Expand Down Expand Up @@ -158,12 +158,12 @@ public void init(FilterConfig config) throws ServletException {
String dynamicNamingRecognizedHosts = config.getInitParameter("dynamicNamingRecognizedHosts");
if (StringValidator.isNotNullOrBlank(dynamicNamingFallbackName)) {
if (StringValidator.isNotNullOrBlank(dynamicNamingRecognizedHosts)) {
segmentNamingStrategy = new DynamicSegmentNamingStrategy(dynamicNamingFallbackName, dynamicNamingRecognizedHosts);
segmentNamingStrategy = SegmentNamingStrategy.dynamic(dynamicNamingFallbackName, dynamicNamingRecognizedHosts);
} else {
segmentNamingStrategy = new DynamicSegmentNamingStrategy(dynamicNamingFallbackName);
segmentNamingStrategy = SegmentNamingStrategy.dynamic(dynamicNamingFallbackName);
}
} else if (StringValidator.isNotNullOrBlank(fixedName)) {
segmentNamingStrategy = new FixedSegmentNamingStrategy(fixedName);
segmentNamingStrategy = SegmentNamingStrategy.fixed(fixedName);
} else if (null == segmentNamingStrategy) {
throw new ServletException(
"The AWSXRayServletFilter requires either a fixedName init-param or an instance of SegmentNamingStrategy. "
Expand Down

0 comments on commit babdde3

Please sign in to comment.