在学习了前面关于多线程的博客以后,下面来介绍一个构建可靠成果缓存的例子。现在有以下场景:
import java.math.BigInteger;
interface Computable<A,V>{
public V compute(A arg) throws InterruptedException;
}
public class Demo implements Computable<String,BigInteger>{
public BigInteger compute(String arg) throws InterruptedException{
return new BigInteger(arg);
}
}impor