0
目前我有这个类。当我删除QueryResult时,它运行主方法并自行完成。当我添加QueryResult时,我需要手动终止运行。我怎样才能让这个优雅地结束?谢谢。neo4j QueryResult不会退出
public class TestConnect {
public static void main(String[] args) {
System.out.println("starting test");
final RestAPI api = new RestAPIFacade("http://localhost:7474/db/data");
System.out.println("API created");
final RestCypherQueryEngine engine = new RestCypherQueryEngine(api);
System.out.println("engine created");
QueryResult<Map<String,Object>> result = engine.query("start n=node({id}) return n;", map("id",0));
}
}
编辑: 我使用的Java 7
所以这将工作,但这需要对象实现java.lang.autocloseable – Badmiral 2013-04-22 14:30:41
确实,这是java.io.Closable的父项,所以所有这些工作以及。 – 2013-04-22 22:15:16