Proper way to shutdown the Neo4J data store in a web app?

76 views
Skip to first unread message

Tero Paananen

unread,
Dec 20, 2011, 4:40:49 PM12/20/11
to Neo4j
I'm using Neo4J in a Java web app based on Jersey and SDN running on
Jetty.
It's essentially a servlet based web app.

What's the proper way to shutdown the Neo4J store in this kind of
application?

Since I'm not using Spring MVC, I don't have a convenient way to
reference the
Neo4J graphDatabaseService bean with the ServletContextListener
lifecycle
methods.

Specifying a destroy-method in the bean definition for the
graphDatabaseService
bean doesn't appear to be doing much:

<bean id="graphDatabaseService"
class="org.neo4j.kernel.EmbeddedGraphDatabase"
destroy-method="shutdown">
<constructor-arg index="0" value="data/graph.db" />
</bean>

It does not get called, when I stop Jetty.

-TPP

Michael Hunger

unread,
Dec 20, 2011, 11:43:57 PM12/20/11
to ne...@googlegroups.com
You can still use the http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/web/context/support/WebApplicationContextUtils.html to access the context you registered as context-listener.

The shutdown method of the context-listener will shut-down the context will shut down the database.

Michael

Reply all
Reply to author
Forward
0 new messages