mirror of https://github.com/apache/lucene.git
tests: cancel Timer
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1579125 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
daa10a5435
commit
ee0eeb2d77
|
@ -100,28 +100,34 @@ public class StressHdfsTest extends BasicDistributedZkTest {
|
|||
}
|
||||
|
||||
if (testRestartIntoSafeMode) {
|
||||
createCollection(DELETE_DATA_DIR_COLLECTION, 1, 1, 1);
|
||||
|
||||
waitForRecoveriesToFinish(DELETE_DATA_DIR_COLLECTION, false);
|
||||
|
||||
ChaosMonkey.stop(jettys.get(0));
|
||||
|
||||
// enter safe mode and restart a node
|
||||
NameNodeAdapter.enterSafeMode(dfsCluster.getNameNode(), false);
|
||||
|
||||
int rnd = LuceneTestCase.random().nextInt(10000);
|
||||
Timer timer = new Timer();
|
||||
timer.schedule(new TimerTask() {
|
||||
|
||||
try {
|
||||
createCollection(DELETE_DATA_DIR_COLLECTION, 1, 1, 1);
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
NameNodeAdapter.leaveSafeMode(dfsCluster.getNameNode());
|
||||
}
|
||||
}, rnd);
|
||||
|
||||
ChaosMonkey.start(jettys.get(0));
|
||||
|
||||
waitForRecoveriesToFinish(DELETE_DATA_DIR_COLLECTION, false);
|
||||
waitForRecoveriesToFinish(DELETE_DATA_DIR_COLLECTION, false);
|
||||
|
||||
ChaosMonkey.stop(jettys.get(0));
|
||||
|
||||
// enter safe mode and restart a node
|
||||
NameNodeAdapter.enterSafeMode(dfsCluster.getNameNode(), false);
|
||||
|
||||
int rnd = LuceneTestCase.random().nextInt(10000);
|
||||
|
||||
timer.schedule(new TimerTask() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
NameNodeAdapter.leaveSafeMode(dfsCluster.getNameNode());
|
||||
}
|
||||
}, rnd);
|
||||
|
||||
ChaosMonkey.start(jettys.get(0));
|
||||
|
||||
waitForRecoveriesToFinish(DELETE_DATA_DIR_COLLECTION, false);
|
||||
} finally {
|
||||
timer.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue