简体   繁体   English

Neo4j - 数据库关闭

[英]Neo4j - database shutdown

I am using Neo4j embedded in my Scala project. 我在我的Scala项目中使用了Neo4j。 I have been including 我一直包括在内

ShutdownHookThread {
    shutdown(ds)
    }

the above piece of code in each and every function before the beginning of transaction. 在交易开始之前的每个函数中的上面一段代码。 Do I need to include it in every function. 我是否需要将其包含在每个功能中。 What happens if I don't include it? 如果我不包括它会怎么样?

ShutdownHookThread registers a piece of code to be executed when your application is about to exit. ShutdownHookThread注册一个代码片段,以便在您的应用程序即将退出时执行。 You need to use it only once - somewhere in your app bootstrap code, cause there is no sense to shutdown the database more than one time. 您只需要在应用程序引导程序代码中的某个位置使用它一次,因为没有任何意义可以多次关闭数据库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM