Skip to content

Commit

Permalink
refactor(CffuTtlExecutorWrapperProvider): skip wrapping if it is ma…
Browse files Browse the repository at this point in the history
…rked with `TtlEnhanced`
  • Loading branch information
oldratlee committed Nov 23, 2024
1 parent 08b0ec3 commit c32bacc
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.foldright.cffu.ttl;

import com.alibaba.ttl.spi.TtlEnhanced;
import com.alibaba.ttl.threadpool.TtlExecutors;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
Expand All @@ -23,6 +24,8 @@ public final class CffuTtlExecutorWrapperProvider implements ExecutorWrapperProv
@Override
@SuppressFBWarnings("NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE")
public Executor wrap(@NonNull Executor executor) {
return TtlExecutors.getTtlExecutor(requireNonNull(executor, "executor is null"));
requireNonNull(executor, "executor is null");
if (executor instanceof TtlEnhanced) return executor;
return TtlExecutors.getTtlExecutor(executor);
}
}

0 comments on commit c32bacc

Please sign in to comment.