com.baidu.unbiz.fluentvalidator.support
类 ConcurrentCache<K,V>

java.lang.Object
  继承者 com.baidu.unbiz.fluentvalidator.support.ConcurrentCache<K,V>
所有已实现的接口:
Computable<K,V>

public class ConcurrentCache<K,V>
extends Object
implements Computable<K,V>

此类不用额外使用自旋锁或者同步器,可保证并发时线程安全,在并发情况下具有高性能


字段摘要
protected  ConcurrentMap<K,Future<V>> concurrentMap
           
 
构造方法摘要
ConcurrentCache()
           
 
方法摘要
static
<K,V> Computable<K,V>
createComputable()
           
 V get(K key, Callable<V> callable)
          通过关键字获取数据,如果存在则直接返回,如果不存在,则通过计算callable来生成
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

concurrentMap

protected final ConcurrentMap<K,Future<V>> concurrentMap
构造方法详细信息

ConcurrentCache

public ConcurrentCache()
方法详细信息

createComputable

public static <K,V> Computable<K,V> createComputable()

get

public V get(K key,
             Callable<V> callable)
通过关键字获取数据,如果存在则直接返回,如果不存在,则通过计算callable来生成

指定者:
接口 Computable<K,V> 中的 get
参数:
key - 查找关键字
callable - # @see Callable
返回:
计算结果


Copyright © 2015–2016 neoremind. All rights reserved.