- Cache<Key,Value> cache =CacheBuilder.newBuilder()
- .maximumSize(1000)
- .build();
- ...
- try{
-
-
- cache.get(key,newCallable<Value>(){
- @Override
- publicValue call()throwsAnyException{
- return doThingsTheHardWay(key);
- }
- });
- }catch(ExecutionException e){
- thrownewOtherException(e.getCause());
- }
使用Guava适配不同的callback
原文:http://www.cnblogs.com/panxuejun/p/7623835.html