Skip to content

Commit

Permalink
Merge pull request #419 from Netflix/dannyt/avoid-executor-service-au…
Browse files Browse the repository at this point in the history
…toclose

Ignore AutoClosable interface on ExecutorService
  • Loading branch information
DanielThomas authored Mar 20, 2023
2 parents 238f28f + 2c1663f commit 961df38
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 961df38

Please sign in to comment.