• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java CachePoolEntry类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



CachePoolEntry类属于org.apache.hadoop.hdfs.protocol包,在下文中一共展示了CachePoolEntry类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: listCachePools

import org.apache.hadoop.hdfs.protocol.CachePoolEntry; //导入依赖的package包/类
BatchedListEntries<CachePoolEntry> listCachePools(String prevKey)
    throws IOException {
  BatchedListEntries<CachePoolEntry> results;
  checkOperation(OperationCategory.READ);
  boolean success = false;
  cacheManager.waitForRescanIfNeeded();
  readLock();
  try {
    checkOperation(OperationCategory.READ);
    results = FSNDNCacheOp.listCachePools(this, cacheManager, prevKey);
    success = true;
  } finally {
    readUnlock();
    logAuditEvent(success, "listCachePools", null, null, null);
  }
  return results;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:FSNamesystem.java


示例2: listCachePools

import org.apache.hadoop.hdfs.protocol.CachePoolEntry; //导入依赖的package包/类
public BatchedListEntries<CachePoolEntry>
    listCachePools(FSPermissionChecker pc, String prevKey) {
  assert namesystem.hasReadLock();
  final int NUM_PRE_ALLOCATED_ENTRIES = 16;
  ArrayList<CachePoolEntry> results = 
      new ArrayList<CachePoolEntry>(NUM_PRE_ALLOCATED_ENTRIES);
  SortedMap<String, CachePool> tailMap = cachePools.tailMap(prevKey, false);
  int numListed = 0;
  for (Entry<String, CachePool> cur : tailMap.entrySet()) {
    if (numListed++ >= maxListCachePoolsResponses) {
      return new BatchedListEntries<CachePoolEntry>(results, true);
    }
    results.add(cur.getValue().getEntry(pc));
  }
  return new BatchedListEntries<CachePoolEntry>(results, false);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:17,代码来源:CacheManager.java


示例3: listCachePools

import org.apache.hadoop.hdfs.protocol.CachePoolEntry; //导入依赖的package包/类
@Override
public ListCachePoolsResponseProto listCachePools(RpcController controller,
    ListCachePoolsRequestProto request) throws ServiceException {
  try {
    BatchedEntries<CachePoolEntry> entries =
      server.listCachePools(request.getPrevPoolName());
    ListCachePoolsResponseProto.Builder responseBuilder =
      ListCachePoolsResponseProto.newBuilder();
    responseBuilder.setHasMore(entries.hasMore());
    for (int i=0, n=entries.size(); i<n; i++) {
      responseBuilder.addEntries(PBHelper.convert(entries.get(i)));
    }
    return responseBuilder.build();
  } catch (IOException e) {
    throw new ServiceException(e);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:ClientNamenodeProtocolServerSideTranslatorPB.java


示例4: listCachePools

import org.apache.hadoop.hdfs.protocol.CachePoolEntry; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void listCachePools(
    HashSet<String> poolNames, int active) throws Exception {
  HashSet<String> tmpNames = (HashSet<String>)poolNames.clone();
  RemoteIterator<CachePoolEntry> pools = dfs.listCachePools();
  int poolCount = poolNames.size();
  for (int i=0; i<poolCount; i++) {
    CachePoolEntry pool = pools.next();
    String pollName = pool.getInfo().getPoolName();
    assertTrue("The pool name should be expected", tmpNames.remove(pollName));
    if (i % 2 == 0) {
      int standby = active;
      active = (standby == 0) ? 1 : 0;
      cluster.transitionToStandby(standby);
      cluster.transitionToActive(active);
      cluster.waitActive(active);
    }
  }
  assertTrue("All pools must be found", tmpNames.isEmpty());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:TestRetryCacheWithHA.java


示例5: listCachePools

import org.apache.hadoop.hdfs.protocol.CachePoolEntry; //导入依赖的package包/类
@Override
public ListCachePoolsResponseProto listCachePools(RpcController controller,
    ListCachePoolsRequestProto request) throws ServiceException {
  try {
    BatchedEntries<CachePoolEntry> entries =
      server.listCachePools(request.getPrevPoolName());
    ListCachePoolsResponseProto.Builder responseBuilder =
      ListCachePoolsResponseProto.newBuilder();
    responseBuilder.setHasMore(entries.hasMore());
    for (int i=0, n=entries.size(); i<n; i++) {
      responseBuilder.addEntries(PBHelperClient.convert(entries.get(i)));
    }
    return responseBuilder.build();
  } catch (IOException e) {
    throw new ServiceException(e);
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:18,代码来源:ClientNamenodeProtocolServerSideTranslatorPB.java


示例6: getAllCachePools

import org.apache.hadoop.hdfs.protocol.CachePoolEntry; //导入依赖的package包/类
List<CachePoolEntry> getAllCachePools(UpstreamManager.Upstream upstream) throws IOException {
    String prevPool = "";
    List<CachePoolEntry> pools = new ArrayList<>();

    while (true) {
        BatchedRemoteIterator.BatchedEntries<CachePoolEntry> it = upstream.protocol.listCachePools(prevPool);
        if (it.size() == 0) {
            break;
        }
        for (int i = 0; i < it.size(); i++) {
            CachePoolEntry entry = it.get(i);
            prevPool = entry.getInfo().getPoolName();
            pools.add(entry);
        }
    }
    return pools;
}
 
开发者ID:bytedance,项目名称:nnproxy,代码行数:18,代码来源:CacheRegistry.java


示例7: listCachePools

import org.apache.hadoop.hdfs.protocol.CachePoolEntry; //导入依赖的package包/类
public BatchedListEntries<CachePoolEntry> listCachePools(String prevKey)
    throws IOException {
  final FSPermissionChecker pc =
      isPermissionEnabled ? getPermissionChecker() : null;
  BatchedListEntries<CachePoolEntry> results;
  checkOperation(OperationCategory.READ);
  boolean success = false;
  cacheManager.waitForRescanIfNeeded();
  readLock();
  try {
    checkOperation(OperationCategory.READ);
    results = cacheManager.listCachePools(pc, prevKey);
    success = true;
  } finally {
    readUnlock();
    if (isAuditEnabled() && isExternalInvocation()) {
      logAuditEvent(success, "listCachePools", null, null, null);
    }
  }
  return results;
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:22,代码来源:FSNamesystem.java


示例8: getEntry

import org.apache.hadoop.hdfs.protocol.CachePoolEntry; //导入依赖的package包/类
/**
 * Returns a CachePoolInfo describing this CachePool based on the permissions
 * of the calling user. Unprivileged users will see only minimal descriptive
 * information about the pool.
 * 
 * @param pc Permission checker to be used to validate the user's permissions,
 *          or null
 * @return CachePoolEntry describing this CachePool
 */
public CachePoolEntry getEntry(FSPermissionChecker pc) {
  boolean hasPermission = true;
  if (pc != null) {
    try {
      pc.checkPermission(this, FsAction.READ);
    } catch (AccessControlException e) {
      hasPermission = false;
    }
  }
  return new CachePoolEntry(getInfo(hasPermission), 
      hasPermission ? getStats() : new CachePoolStats.Builder().build());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:CachePool.java


示例9: listCachePools

import org.apache.hadoop.hdfs.protocol.CachePoolEntry; //导入依赖的package包/类
@Override
public BatchedEntries<CachePoolEntry> listCachePools(String prevKey)
    throws IOException {
  try {
    return new BatchedCachePoolEntries(
      rpcProxy.listCachePools(null,
        ListCachePoolsRequestProto.newBuilder().
          setPrevPoolName(prevKey).build()));
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:13,代码来源:ClientNamenodeProtocolTranslatorPB.java


示例10: checkNamenodeBeforeReturn

import org.apache.hadoop.hdfs.protocol.CachePoolEntry; //导入依赖的package包/类
@Override
boolean checkNamenodeBeforeReturn() throws Exception {
  for (int i = 0; i < CHECKTIMES; i++) {
    RemoteIterator<CachePoolEntry> iter = dfs.listCachePools();
    if (iter.hasNext()) {
      return true;
    }
    Thread.sleep(1000);
  }
  return false;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:12,代码来源:TestRetryCacheWithHA.java


示例11: testListCachePoolPermissions

import org.apache.hadoop.hdfs.protocol.CachePoolEntry; //导入依赖的package包/类
@Test(timeout=60000)
public void testListCachePoolPermissions() throws Exception {
  final UserGroupInformation myUser = UserGroupInformation
      .createRemoteUser("myuser");
  final DistributedFileSystem myDfs = 
      (DistributedFileSystem)DFSTestUtil.getFileSystemAs(myUser, conf);
  final String poolName = "poolparty";
  dfs.addCachePool(new CachePoolInfo(poolName)
      .setMode(new FsPermission((short)0700)));
  // Should only see partial info
  RemoteIterator<CachePoolEntry> it = myDfs.listCachePools();
  CachePoolInfo info = it.next().getInfo();
  assertFalse(it.hasNext());
  assertEquals("Expected pool name", poolName, info.getPoolName());
  assertNull("Unexpected owner name", info.getOwnerName());
  assertNull("Unexpected group name", info.getGroupName());
  assertNull("Unexpected mode", info.getMode());
  assertNull("Unexpected limit", info.getLimit());
  // Modify the pool so myuser is now the owner
  final long limit = 99;
  dfs.modifyCachePool(new CachePoolInfo(poolName)
      .setOwnerName(myUser.getShortUserName())
      .setLimit(limit));
  // Should see full info
  it = myDfs.listCachePools();
  info = it.next().getInfo();
  assertFalse(it.hasNext());
  assertEquals("Expected pool name", poolName, info.getPoolName());
  assertEquals("Mismatched owner name", myUser.getShortUserName(),
      info.getOwnerName());
  assertNotNull("Expected group name", info.getGroupName());
  assertEquals("Mismatched mode", (short) 0700,
      info.getMode().toShort());
  assertEquals("Mismatched limit", limit, (long)info.getLimit());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:36,代码来源:TestCacheDirectives.java


示例12: listCachePools

import org.apache.hadoop.hdfs.protocol.CachePoolEntry; //导入依赖的package包/类
@Override
public BatchedEntries<CachePoolEntry> listCachePools(String prevKey)
    throws IOException {
  try {
    return new BatchedCachePoolEntries(
        rpcProxy.listCachePools(null,
            ListCachePoolsRequestProto.newBuilder().
                setPrevPoolName(prevKey).build()));
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:13,代码来源:ClientNamenodeProtocolTranslatorPB.java


示例13: listCachePools

import org.apache.hadoop.hdfs.protocol.CachePoolEntry; //导入依赖的package包/类
public BatchedRemoteIterator.BatchedListEntries<CachePoolEntry> listCachePools(String prevKey) {
    final int NUM_PRE_ALLOCATED_ENTRIES = 16;
    ArrayList<CachePoolEntry> results =
            new ArrayList<CachePoolEntry>(NUM_PRE_ALLOCATED_ENTRIES);
    SortedMap<String, CachePoolEntry> tailMap = cachePools.tailMap(prevKey, false);
    int numListed = 0;
    for (Map.Entry<String, CachePoolEntry> cur : tailMap.entrySet()) {
        if (numListed++ >= maxListCachePoolsResponses) {
            return new BatchedRemoteIterator.BatchedListEntries<>(results, true);
        }
        results.add(cur.getValue());
    }
    return new BatchedRemoteIterator.BatchedListEntries<>(results, false);
}
 
开发者ID:bytedance,项目名称:nnproxy,代码行数:15,代码来源:CacheRegistry.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java FieldOutline类代码示例发布时间:2022-05-23
下一篇:
Java ApiResponse类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap