I have Jersery Rest service and i am using Neo4j Embedded Database to serve requests with data.
Now when i make concurrent GET requests it works fine.
But when i make concurrent POST requests It gives Following Exception :
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)
I know the problem is if there is already instance of neo4j running we can't access the same with another thread.
Solution would be Neo4j HA
But as i dont have enough time to configure Neo4j HA cluster, can anyone please suggest me on How can i make POST request to be single threaded (means no concurrent threads accessing Neo4j at the same time).
Any link or tutorial.
Edit
I am starting neo4j like this:
GraphDatabaseService graphdb = new GraphDatabaseFactory().newEmbeddedDatabase("D:/GraphDB");'
and in finally
block i am doing
graphdb.shutdown();