Skip to content

Commit

Permalink
Ignore AutoClosable interface on ExecutorService
Browse files Browse the repository at this point in the history
JDK 19 adds AutoClosable to ExecutorService and existing injection points will not expect ExecutorService to be suddenly subject to PreDestroy lifecycle management.
  • Loading branch information
DanielThomas committed Mar 17, 2023
1 parent 238f28f commit 2c1663f
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ExecutorService;

import javax.annotation.PreDestroy;

Expand Down Expand Up @@ -53,7 +54,7 @@ private class PreDestroyVisitor implements TypeVisitor, Supplier<List<Lifecycle
@Override
public boolean visit(final Class<?> clazz) {
boolean continueVisit = !clazz.isInterface();
if (continueVisit && AutoCloseable.class.isAssignableFrom(clazz)) {
if (continueVisit && AutoCloseable.class.isAssignableFrom(clazz) && !ExecutorService.class.isAssignableFrom(clazz)) {
AutoCloseableLifecycleAction closeableAction = new AutoCloseableLifecycleAction(
clazz.asSubclass(AutoCloseable.class));
LOG.debug("adding action {}", closeableAction);
Expand Down

0 comments on commit 2c1663f

Please sign in to comment.