I'm using Hectors EmbeddedServerHelper
to set up embedded Cassandra. It has teardown()
and cleanup()
methods.
The problem is that cleanup method cannot delete some commit log files created by cassandra. Probably because there are still some cassandra daemons that were not properly shut down by the teardown() method. Here us the setup and teardown code:
@BeforeClass
public static void setUpBeforeClass() throws Exception {
EmbeddedServerHelper sh = new EmbeddedServerHelper();
sh.setup();
}
@AfterClass
public static void tearDownAfterClass() throws Exception {
EmbeddedServerHelper.teardown();
EmbeddedServerHelper.cleanup();
doDelete(new File("tmp"));
}
How can I delete these files?
The data files and commit logs are checked-for and deleted on startup as it was quite difficult to know when the cassandra process was done with cleaning up from the context of JUnit.
来源:https://stackoverflow.com/questions/7944287/how-to-cleanup-embedded-cassandra-after-unittest