我有Jersery REST服务 ,我使用的Neo4j嵌入式数据库服务数据请求。
现在,当我做出并发GET请求它工作正常。
但是,当我做并发POST请求,它提供了以下情况除外:
Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.kernel.StoreLockerLifecycleAdapter@62f1ca5e' was successfully initialized, but failed to start. Please see attached cause exception.
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:504)
at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:115)
at org.neo4j.kernel.InternalAbstractGraphDatabase.run(InternalAbstractGraphDatabase.java:296)
... 42 more
Caused by: org.neo4j.kernel.StoreLockException: Could not create lock file
at org.neo4j.kernel.StoreLocker.checkLock(StoreLocker.java:85)
at org.neo4j.kernel.StoreLockerLifecycleAdapter.start(StoreLockerLifecycleAdapter.java:40)
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:498)
我知道这个问题是如果已经有Neo4j的运行情况下,我们不能访问相同的另一个线程。
解决办法是Neo4j的HA
但正如我没有足够的时间来配置Neo4j的HA群集,任何人都可以请建议我我如何可以使POST请求是单线程(意味着没有并发线程同时访问Neo4j的)。
任何链接或教程。
编辑
我开始Neo4j的是这样的:
GraphDatabaseService graphdb = new GraphDatabaseFactory().newEmbeddedDatabase("D:/GraphDB");'
并在finally
块我在做什么
graphdb.shutdown();