io.foldright.cffu.ttl.CffuTtlExecutorWrapperProvider Maven / Gradle / Ivy
package io.foldright.cffu.ttl;
import com.alibaba.ttl.threadpool.TtlExecutors;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import io.foldright.cffu.spi.ExecutorWrapperProvider;
import java.util.concurrent.Executor;
import static java.util.Objects.requireNonNull;
/**
* Cffu executor wrapper provider({@link ExecutorWrapperProvider}) SPI implementation for
* 📌 TransmittableThreadLocal (TTL).
*/
public final class CffuTtlExecutorWrapperProvider implements ExecutorWrapperProvider {
/**
* Returns the {@code TTL}
* executor wrapper of the given executor.
*/
@NonNull
@Override
@SuppressFBWarnings("NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE")
public Executor wrap(@NonNull Executor executor) {
return TtlExecutors.getTtlExecutor(requireNonNull(executor, "executor is null"));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy