Skip to content

Commit

Permalink
[Performance kbss-cvut#287] Resolve invalid thread synchronization
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaskabc committed Sep 5, 2024
1 parent c8bf2fa commit 41a9546
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ private static StandardEvaluationContext makeDefaultContext() {
* @throws IllegalCallerException when the annotated method returns another type than {@code void}, {@link Void} or {@link Future}
* @implNote Around advice configured in {@code spring-aop.xml}
*/
public synchronized @Nullable Object throttleMethodCall(@NotNull ProceedingJoinPoint joinPoint,
public @Nullable Object throttleMethodCall(@NotNull ProceedingJoinPoint joinPoint,
@NotNull Throttle throttleAnnotation) throws Throwable {

// if the current thread is already executing a throttled code, we want to skip further throttling
Expand All @@ -165,6 +165,12 @@ private static StandardEvaluationContext makeDefaultContext() {
return result;
}

return doThrottle(joinPoint, throttleAnnotation);
}

private synchronized @Nullable Object doThrottle(@NotNull ProceedingJoinPoint joinPoint,
@NotNull Throttle throttleAnnotation) throws Throwable {

final MethodSignature signature = (MethodSignature) joinPoint.getSignature();

// construct the throttle instance key
Expand Down

0 comments on commit 41a9546

Please sign in to comment.