How to cleanup embedded cassandra after unittest?

倖福魔咒の 提交于 2019-12-07 17:45:37

问题


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?


回答1:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!