当前位置: 首页>>代码示例>>Java>>正文


Java Waitable.getVal方法代码示例

本文整理汇总了Java中org.apache.hadoop.util.Waitable.getVal方法的典型用法代码示例。如果您正苦于以下问题:Java Waitable.getVal方法的具体用法?Java Waitable.getVal怎么用?Java Waitable.getVal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.util.Waitable的用法示例。


在下文中一共展示了Waitable.getVal方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: purge

import org.apache.hadoop.util.Waitable; //导入方法依赖的package包/类
/**
 * Purge a replica from the cache.
 *
 * This doesn't necessarily close the replica, since there may be
 * outstanding references to it.  However, it does mean the cache won't
 * hand it out to anyone after this.
 *
 * You must hold the cache lock while calling this function.
 *
 * @param replica   The replica being removed.
 */
private void purge(ShortCircuitReplica replica) {
  boolean removedFromInfoMap = false;
  String evictionMapName = null;
  Preconditions.checkArgument(!replica.purged);
  replica.purged = true;
  Waitable<ShortCircuitReplicaInfo> val = replicaInfoMap.get(replica.key);
  if (val != null) {
    ShortCircuitReplicaInfo info = val.getVal();
    if ((info != null) && (info.getReplica() == replica)) {
      replicaInfoMap.remove(replica.key);
      removedFromInfoMap = true;
    }
  }
  Long evictableTimeNs = replica.getEvictableTimeNs();
  if (evictableTimeNs != null) {
    evictionMapName = removeEvictable(replica);
  }
  if (LOG.isTraceEnabled()) {
    StringBuilder builder = new StringBuilder();
    builder.append(this).append(": ").append(": purged ").
        append(replica).append(" from the cache.");
    if (removedFromInfoMap) {
      builder.append("  Removed from the replicaInfoMap.");
    }
    if (evictionMapName != null) {
      builder.append("  Removed from ").append(evictionMapName);
    }
    LOG.trace(builder.toString());
  }
  unref(replica);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:43,代码来源:ShortCircuitCache.java


注:本文中的org.apache.hadoop.util.Waitable.getVal方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。