package org.hongxi.whatsmars.common.mdc; import java.util.concurrent.Callable; import java.util.function.Consumer; import java.util.function.Supplier; /** * Created by shenhongxi on 2020/8/16. */ public final class MDCTool { public static MDCSupplier supplier(Supplier supplier) { return new MDCSupplier<>(supplier); } public static MDCRunnable runnable(Runnable runnable) { return new MDCRunnable(runnable); } public static MDCRunnable runnable(Consumer consumer) { return new MDCRunnable(() -> { consumer.accept(null); }); } public static MDCCallable callable(Callable callable) { return new MDCCallable<>(callable); } public static MDCCallable callable(Supplier supplier) { return new MDCCallable<>(() -> supplier.get()); } }