com.jn.langx.util.concurrent.WrappedTasks Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of langx-java Show documentation
Show all versions of langx-java Show documentation
Java lang extensions for java6+, a supplement to , replacement of a Guava, commons-lang.
Core utilities, Collection utilities, IO utilities, Cache, Configuration library ...
package com.jn.langx.util.concurrent;
import com.jn.langx.util.Preconditions;
import java.util.concurrent.Callable;
/**
* @author jinuo.fang
*/
public class WrappedTasks {
public static WrappedRunnable wrap(Runnable target) {
Preconditions.checkNotNull(target);
return ((target instanceof WrappedRunnable) ? (WrappedRunnable) target : new WrappedRunnable(target));
}
public static WrappedCallable wrap(Callable target) {
Preconditions.checkNotNull(target);
return ((target instanceof WrappedCallable) ? (WrappedCallable) target : new WrappedCallable(target));
}
}