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


Java CacheDirective.getExpiryTime方法代码示例

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


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

示例1: rescanCacheDirectives

import org.apache.hadoop.hdfs.protocol.CacheDirective; //导入方法依赖的package包/类
/**
 * Scan all CacheDirectives.  Use the information to figure out
 * what cache replication factor each block should have.
 */
private void rescanCacheDirectives() {
  FSDirectory fsDir = namesystem.getFSDirectory();
  final long now = new Date().getTime();
  for (CacheDirective directive : cacheManager.getCacheDirectives()) {
    scannedDirectives++;
    // Skip processing this entry if it has expired
    if (directive.getExpiryTime() > 0 && directive.getExpiryTime() <= now) {
      LOG.debug("Directive {}: the directive expired at {} (now = {})",
           directive.getId(), directive.getExpiryTime(), now);
      continue;
    }
    String path = directive.getPath();
    INode node;
    try {
      node = fsDir.getINode(path);
    } catch (UnresolvedLinkException e) {
      // We don't cache through symlinks
      LOG.debug("Directive {}: got UnresolvedLinkException while resolving "
              + "path {}", directive.getId(), path
      );
      continue;
    }
    if (node == null)  {
      LOG.debug("Directive {}: No inode found at {}", directive.getId(),
          path);
    } else if (node.isDirectory()) {
      INodeDirectory dir = node.asDirectory();
      ReadOnlyList<INode> children = dir
          .getChildrenList(Snapshot.CURRENT_STATE_ID);
      for (INode child : children) {
        if (child.isFile()) {
          rescanFile(directive, child.asFile());
        }
      }
    } else if (node.isFile()) {
      rescanFile(directive, node.asFile());
    } else {
      LOG.debug("Directive {}: ignoring non-directive, non-file inode {} ",
          directive.getId(), node);
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:47,代码来源:CacheReplicationMonitor.java

示例2: rescanCacheDirectives

import org.apache.hadoop.hdfs.protocol.CacheDirective; //导入方法依赖的package包/类
/**
 * Scan all CacheDirectives.  Use the information to figure out
 * what cache replication factor each block should have.
 */
private void rescanCacheDirectives() {
  FSDirectory fsDir = namesystem.getFSDirectory();
  final long now = new Date().getTime();
  for (CacheDirective directive : cacheManager.getCacheDirectives()) {
    scannedDirectives++;
    // Skip processing this entry if it has expired
    if (directive.getExpiryTime() > 0 && directive.getExpiryTime() <= now) {
      if (LOG.isDebugEnabled()) {
        LOG.debug("Directive " + directive.getId() + ": the directive " +
            "expired at " + directive.getExpiryTime() + " (now = " +
            now + ")");
      }
      continue;
    }
    String path = directive.getPath();
    INode node;
    try {
      node = fsDir.getINode(path);
    } catch (UnresolvedLinkException e) {
      // We don't cache through symlinks
      if (LOG.isDebugEnabled()) {
        LOG.debug("Directive " + directive.getId() +
            ": got UnresolvedLinkException while resolving path " + path);
      }
      continue;
    }
    if (node == null)  {
      if (LOG.isDebugEnabled()) {
        LOG.debug("Directive " + directive.getId() +
            ": No inode found at " + path);
      }
    } else if (node.isDirectory()) {
      INodeDirectory dir = node.asDirectory();
      ReadOnlyList<INode> children = dir
          .getChildrenList(Snapshot.CURRENT_STATE_ID);
      for (INode child : children) {
        if (child.isFile()) {
          rescanFile(directive, child.asFile());
        }
      }
    } else if (node.isFile()) {
      rescanFile(directive, node.asFile());
    } else {
      if (LOG.isDebugEnabled()) {
        LOG.debug("Directive " + directive.getId() + 
            ": ignoring non-directive, non-file inode " + node);
      }
    }
  }
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:55,代码来源:CacheReplicationMonitor.java


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