-
Notifications
You must be signed in to change notification settings - Fork 38.9k
Closed
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancementA general enhancement
Milestone
Description
ConcurrencyThrottleSupport handles interruption when waiting on its concurrencyCondition by re-interrupting the thread and throwing an IllegalStateException. This makes things slightly awkward to handle up the stack.
Suggestion: re-interrupt but don't throw IllegalStateException, instead return normally and let higher level clients handle it. In the case of ConcurrencyThrottleInterceptor it would do this:
@Override
public @Nullable Object invoke(MethodInvocation methodInvocation) throws Throwable {
beforeAccess();
if (Thread.interrupted()) { // clear
throw new InterruptedException(); // not my problem
}
try {
return methodInvocation.proceed();
}
finally {
afterAccess();
}
}As is right now it makes things awkward to deal with. I just wrote the following code:
catch (IllegalStateException e) {
if (Thread.currentThread().isInterrupted() && Thread.interrupted()) { // clear; VERY IMPORTANT
interrupted = true;
}
// handle e
}I think this is a bug...?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancementA general enhancement