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


Java Nfs3Constant.OUTPUT_STREAM_TIMEOUT_MIN_DEFAULT属性代码示例

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


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

示例1: WriteManager

WriteManager(IdUserGroup iug, final Configuration config) {
  this.iug = iug;
  this.config = config;
  streamTimeout = config.getLong(Nfs3Constant.OUTPUT_STREAM_TIMEOUT,
      Nfs3Constant.OUTPUT_STREAM_TIMEOUT_DEFAULT);
  LOG.info("Stream timeout is " + streamTimeout + "ms.");
  if (streamTimeout < Nfs3Constant.OUTPUT_STREAM_TIMEOUT_MIN_DEFAULT) {
    LOG.info("Reset stream timeout to minimum value " +
        Nfs3Constant.OUTPUT_STREAM_TIMEOUT_MIN_DEFAULT + "ms.");
    streamTimeout = Nfs3Constant.OUTPUT_STREAM_TIMEOUT_MIN_DEFAULT;
  }
  maxStreams = config.getInt(Nfs3Constant.MAX_OPEN_FILES,
      Nfs3Constant.MAX_OPEN_FILES_DEFAULT);
  LOG.info("Maximum open streams is " + maxStreams);
  this.fileContextCache = new OpenFileCtxCache(config, streamTimeout);
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:16,代码来源:WriteManager.java

示例2: WriteManager

WriteManager(IdUserGroup iug, final Configuration config) {
  this.iug = iug;
  this.config = config;
  streamTimeout = config.getLong(Nfs3Constant.OUTPUT_STREAM_TIMEOUT,
      Nfs3Constant.OUTPUT_STREAM_TIMEOUT_DEFAULT);
  LOG.info("Stream timeout is " + streamTimeout + "ms.");
  if (streamTimeout < Nfs3Constant.OUTPUT_STREAM_TIMEOUT_MIN_DEFAULT) {
    LOG.info("Reset stream timeout to minimum value "
        + Nfs3Constant.OUTPUT_STREAM_TIMEOUT_MIN_DEFAULT + "ms.");
    streamTimeout = Nfs3Constant.OUTPUT_STREAM_TIMEOUT_MIN_DEFAULT;
  }
  maxStreams = config.getInt(Nfs3Constant.MAX_OPEN_FILES,
      Nfs3Constant.MAX_OPEN_FILES_DEFAULT);
  LOG.info("Maximum open streams is "+ maxStreams);
  this.fileContextCache = new OpenFileCtxCache(config, streamTimeout);
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:16,代码来源:WriteManager.java

示例3: getEntryToEvict

/**
 * The entry to be evicted is based on the following rules:<br>
 * 1. if the OpenFileCtx has any pending task, it will not be chosen.<br>
 * 2. if there is inactive OpenFileCtx, the first found one is to evict. <br>
 * 3. For OpenFileCtx entries don't belong to group 1 or 2, the idlest one
 * is select. If it's idle longer than OUTPUT_STREAM_TIMEOUT_MIN_DEFAULT, it
 * will be evicted. Otherwise, the whole eviction request is failed.
 */
@VisibleForTesting
Entry<FileHandle, OpenFileCtx> getEntryToEvict() {
  Iterator<Entry<FileHandle, OpenFileCtx>> it =
      openFileMap.entrySet().iterator();
  if (LOG.isTraceEnabled()) {
    LOG.trace("openFileMap size:" + openFileMap.size());
  }

  Entry<FileHandle, OpenFileCtx> idlest = null;
  
  while (it.hasNext()) {
    Entry<FileHandle, OpenFileCtx> pairs = it.next();
    OpenFileCtx ctx = pairs.getValue();
    if (!ctx.getActiveState()) {
      if (LOG.isDebugEnabled()) {
        LOG.debug("Got one inactive stream: " + ctx);
      }
      return pairs;
    }
    if (ctx.hasPendingWork()) {
      // Always skip files with pending work.
      continue;
    }
    if (idlest == null) {
      idlest = pairs;
    } else {
      if (ctx.getLastAccessTime() < idlest.getValue().getLastAccessTime()) {
        idlest = pairs;
      }
    }
  }

  if (idlest == null) {
    LOG.warn("No eviction candidate. All streams have pending work.");
    return null;
  } else {
    long idleTime =
        System.currentTimeMillis() - idlest.getValue().getLastAccessTime();
    if (idleTime < Nfs3Constant.OUTPUT_STREAM_TIMEOUT_MIN_DEFAULT) {
      if (LOG.isDebugEnabled()) {
        LOG.debug("idlest stream's idle time:" + idleTime);
      }
      LOG.warn("All opened streams are busy, can't remove any from cache.");
      return null;
    } else {
      return idlest;
    }
  }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:57,代码来源:OpenFileCtxCache.java

示例4: getEntryToEvict

/**
 * The entry to be evicted is based on the following rules:<br>
 * 1. if the OpenFileCtx has any pending task, it will not be chosen.<br>
 * 2. if there is inactive OpenFileCtx, the first found one is to evict. <br>
 * 3. For OpenFileCtx entries don't belong to group 1 or 2, the idlest one 
 * is select. If it's idle longer than OUTPUT_STREAM_TIMEOUT_MIN_DEFAULT, it
 * will be evicted. Otherwise, the whole eviction request is failed.
 */
@VisibleForTesting
Entry<FileHandle, OpenFileCtx> getEntryToEvict() {
  Iterator<Entry<FileHandle, OpenFileCtx>> it = openFileMap.entrySet()
      .iterator();
  if (LOG.isTraceEnabled()) {
    LOG.trace("openFileMap size:" + openFileMap.size());
  }

  Entry<FileHandle, OpenFileCtx> idlest = null;
  
  while (it.hasNext()) {
    Entry<FileHandle, OpenFileCtx> pairs = it.next();
    OpenFileCtx ctx = pairs.getValue();
    if (!ctx.getActiveState()) {
      if (LOG.isDebugEnabled()) {
        LOG.debug("Got one inactive stream: " + ctx);
      }
      return pairs;
    }
    if (ctx.hasPendingWork()) {
      // Always skip files with pending work.
      continue;
    }
    if (idlest == null) {
      idlest = pairs;
    } else {
      if (ctx.getLastAccessTime() < idlest.getValue().getLastAccessTime()) {
        idlest = pairs;
      }
    }
  }

  if (idlest == null) {
    LOG.warn("No eviction candidate. All streams have pending work.");
    return null;
  } else {
    long idleTime = System.currentTimeMillis()
        - idlest.getValue().getLastAccessTime();
    if (idleTime < Nfs3Constant.OUTPUT_STREAM_TIMEOUT_MIN_DEFAULT) {
      if (LOG.isDebugEnabled()) {
        LOG.debug("idlest stream's idle time:" + idleTime);
      }
      LOG.warn("All opened streams are busy, can't remove any from cache.");
      return null;
    } else {
      return idlest;
    }
  }
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:57,代码来源:OpenFileCtxCache.java


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