本文整理汇总了Java中org.apache.hadoop.hdfs.server.namenode.FSEditLog.setRuntimeForTesting方法的典型用法代码示例。如果您正苦于以下问题:Java FSEditLog.setRuntimeForTesting方法的具体用法?Java FSEditLog.setRuntimeForTesting怎么用?Java FSEditLog.setRuntimeForTesting使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.hdfs.server.namenode.FSEditLog
的用法示例。
在下文中一共展示了FSEditLog.setRuntimeForTesting方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import org.apache.hadoop.hdfs.server.namenode.FSEditLog; //导入方法依赖的package包/类
public void setUp(Configuration confg, MiniJournalCluster jCluster,
String name)
throws Exception {
LOG.info("START TEST : " + name);
handler = new TestAvatarQJMFailuresHandler();
InjectionHandler.set(handler);
FSEditLog.setRuntimeForTesting(Runtime.getRuntime());
conf = confg;
if (jCluster == null) {
cluster = new MiniAvatarCluster.Builder(conf).numDataNodes(1)
.enableQJM(true).build();
} else {
cluster = new MiniAvatarCluster.Builder(conf).numDataNodes(1)
.enableQJM(true).setJournalCluster(jCluster).build();
}
fs = cluster.getFileSystem();
journalCluster = cluster.getJournalCluster();
}
示例2: processNamenodesForShutdown
import org.apache.hadoop.hdfs.server.namenode.FSEditLog; //导入方法依赖的package包/类
private void processNamenodesForShutdown(Collection<Thread> threads) {
Runtime runtime = Runtime.getRuntime();
runtime = spy(runtime);
doNothing().when(runtime).exit(anyInt());
FSEditLog.setRuntimeForTesting(runtime);
for (NameNodeInfo nnInfo : nameNodes) {
Thread st = new Thread(new ShutDownUtil(nnInfo));
st.start();
threads.add(st);
}
}
示例3: testJournalClusterFailureWhenRequired
import org.apache.hadoop.hdfs.server.namenode.FSEditLog; //导入方法依赖的package包/类
/**
* Tests that if the journal cluster is marked as required, we cannot
* tolerate its failure.
*/
@Test
public void testJournalClusterFailureWhenRequired() throws Exception {
Configuration conf = new Configuration();
journalCluster = new MiniJournalCluster.Builder(conf).numJournalNodes(
3).build();
String journalURI = journalCluster.getQuorumJournalURI(
MiniAvatarCluster.JID).toString();
conf.set("dfs.name.edits.dir.required", journalURI + "/zero," + journalURI
+ "/one");
setUp(conf, journalCluster, "testJournalClusterFailureWhenRequired");
// spy the runtime
Runtime runtime = Runtime.getRuntime();
runtime = spy(runtime);
doNothing().when(runtime).exit(anyInt());
FSEditLog.setRuntimeForTesting(runtime);
// Kill standby to ensure only 1 runtime.exit();
cluster.killStandby();
journalCluster.shutdown();
fs.create(new Path("/test1"));
// verify failure.
verify(runtime, times(1)).exit(anyInt());
}
示例4: setUp
import org.apache.hadoop.hdfs.server.namenode.FSEditLog; //导入方法依赖的package包/类
public void setUp(String name) throws Exception {
LOG.info("START TEST : " + name);
handler = new TestAvatarQJMFailuresHandler();
InjectionHandler.set(handler);
FSEditLog.setRuntimeForTesting(Runtime.getRuntime());
conf = new Configuration();
cluster = new MiniAvatarCluster.Builder(conf).numDataNodes(1)
.enableQJM(true).build();
fs = cluster.getFileSystem();
journalCluster = cluster.getJournalCluster();
}
示例5: setUp
import org.apache.hadoop.hdfs.server.namenode.FSEditLog; //导入方法依赖的package包/类
private void setUp(String name) throws Exception {
LOG.info("------------------- test: " + name + " START ----------------");
conf = new Configuration();
conf.setLong("fs.checkpoint.period", 3600);
cluster = new MiniAvatarCluster(conf, 2, true, null, null);
fs = cluster.getFileSystem();
// spy the runtime
runtime = Runtime.getRuntime();
runtime = spy(runtime);
doNothing().when(runtime).exit(anyInt());
FSEditLog.setRuntimeForTesting(runtime);
}