本文整理匯總了Java中org.apache.hadoop.hdfs.server.namenode.BlockPlacementPolicyRaid.CachedFullPathNames類的典型用法代碼示例。如果您正苦於以下問題:Java CachedFullPathNames類的具體用法?Java CachedFullPathNames怎麽用?Java CachedFullPathNames使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
CachedFullPathNames類屬於org.apache.hadoop.hdfs.server.namenode.BlockPlacementPolicyRaid包,在下文中一共展示了CachedFullPathNames類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: verifyCachedFullPathNameResult
import org.apache.hadoop.hdfs.server.namenode.BlockPlacementPolicyRaid.CachedFullPathNames; //導入依賴的package包/類
private void verifyCachedFullPathNameResult(
CachedFullPathNames cachedFullPathNames, FSInodeInfo inode, int cachedReads)
throws IOException {
Assert.assertEquals(inode.getFullPathName(),
policy.getFullPathName(inode));
Assert.assertEquals(cachedReads,
h.events.get(InjectionEvent.BLOCKPLACEMENTPOLICYRAID_CACHED_PATH).intValue());
}
示例2: testCachedPathNames
import org.apache.hadoop.hdfs.server.namenode.BlockPlacementPolicyRaid.CachedFullPathNames; //導入依賴的package包/類
/**
* Test BlockPlacementPolicyRaid.CachedFullPathNames
* Verify that the results obtained from cache is the same as
* the results obtained directly
*/
@Test
public void testCachedPathNames() throws IOException {
setupCluster();
try {
String file1 = "/dir/file1";
String file2 = "/dir/file2";
DFSTestUtil.createFile(fs, new Path(file1), 3, (short)1, 0L);
DFSTestUtil.createFile(fs, new Path(file2), 4, (short)1, 0L);
// test full path cache
CachedFullPathNames cachedFullPathNames =
new CachedFullPathNames(namesystem);
FSInodeInfo inode1 = null;
FSInodeInfo inode2 = null;
namesystem.dir.readLock();
try {
inode1 = namesystem.dir.rootDir.getNode(file1, true);
inode2 = namesystem.dir.rootDir.getNode(file2, true);
} finally {
namesystem.dir.readUnlock();
}
verifyCachedFullPathNameResult(cachedFullPathNames, inode1);
verifyCachedFullPathNameResult(cachedFullPathNames, inode1);
verifyCachedFullPathNameResult(cachedFullPathNames, inode2);
verifyCachedFullPathNameResult(cachedFullPathNames, inode2);
try {
Thread.sleep(1200L);
} catch (InterruptedException e) {
}
verifyCachedFullPathNameResult(cachedFullPathNames, inode2);
verifyCachedFullPathNameResult(cachedFullPathNames, inode1);
} finally {
if (cluster != null) {
cluster.shutdown();
}
}
}
示例3: verifyCachedFullPathNameResult
import org.apache.hadoop.hdfs.server.namenode.BlockPlacementPolicyRaid.CachedFullPathNames; //導入依賴的package包/類
private void verifyCachedFullPathNameResult(
CachedFullPathNames cachedFullPathNames, FSInodeInfo inode)
throws IOException {
String res1 = inode.getFullPathName();
String res2 = cachedFullPathNames.get(inode);
LOG.info("Actual path name: " + res1);
LOG.info("Cached path name: " + res2);
Assert.assertEquals(cachedFullPathNames.get(inode),
inode.getFullPathName());
}
示例4: verifyCachedFullPathNameResult
import org.apache.hadoop.hdfs.server.namenode.BlockPlacementPolicyRaid.CachedFullPathNames; //導入依賴的package包/類
private void verifyCachedFullPathNameResult(
CachedFullPathNames cachedFullPathNames, FSInodeInfo inode)
throws IOException {
Assert.assertEquals(cachedFullPathNames.get(inode),
inode.getFullPathName());
}