Yes, I use variable GraphDatabaseService as a static variable, so I can 
make sure that there is just one reference of that.
Thank you very much, the shutdown hook function solved my problem :-)

On Wednesday, February 5, 2014 11:21:00 AM UTC-8, Michael Hunger wrote:
>
> You need only one reference to GraphDatabaseService in your application, 
> that reference is threadsafe and should be shared.
>
> Just make sure to shut down the db cleanly when you shut down your 
> application. E.g. with a shutdown hook.
>
> Michael
>
>
> Am 05.02.2014 um 19:09 schrieb Reihane Boghrati 
> <[email protected]<javascript:>
> >:
>
> Hello,
>
> I've started implementing Client for Neo4j to evaluate that with *BG 
> benchmark* <http://bgbenchmark.org/BG/overview.html>. It was working well 
> with 1 thread, but when I was trying to load the database with more than 1 
> thread, it threw an exception:
>
> java.lang.RuntimeException: Error starting 
> org.neo4j.kernel.EmbeddedGraphDatabase, 
> C:\Users\Reihane\Documents\Neo4j\default.graphdb
> at 
> org.neo4j.kernel.InternalAbstractGraphDatabase.run(InternalAbstractGraphDatabase.java:333)
> at 
> org.neo4j.kernel.EmbeddedGraphDatabase.<init>(EmbeddedGraphDatabase.java:63)
> at 
> org.neo4j.graphdb.factory.GraphDatabaseFactory$1.newDatabase(GraphDatabaseFactory.java:92)
> at 
> org.neo4j.graphdb.factory.GraphDatabaseBuilder.newGraphDatabase(GraphDatabaseBuilder.java:198)
> at 
> org.neo4j.graphdb.factory.GraphDatabaseFactory.newEmbeddedDatabase(GraphDatabaseFactory.java:69)
> at Neo4j.Neo4jClient.init(Neo4jClient.java:110)
> at edu.usc.bg.base.DBWrapper.init(DBWrapper.java:62)
> at edu.usc.bg.base.Client.executeDoLoad(Client.java:1013)
> at edu.usc.bg.base.Client.runBG(Client.java:892)
> at edu.usc.bg.BGMainClass.main(BGMainClass.java:41)
> Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 
> 'org.neo4j.kernel.StoreLockerLifecycleAdapter@2e8da6a9' 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:310)
> ... 9 more
> Caused by: org.neo4j.kernel.StoreLockException: Unable to obtain lock on 
> store lock file: 
> C:\Users\Reihane\Documents\Neo4j\default.graphdb\store_lock. Please ensure 
> no other process is using this database, and that the directory is writable 
> (required even for read-only access)
> at org.neo4j.kernel.StoreLocker.checkLock(StoreLocker.java:87)
> at 
> org.neo4j.kernel.StoreLockerLifecycleAdapter.start(StoreLockerLifecycleAdapter.java:44)
> at 
> org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:498)
> ... 11 more
> Caused by: java.io.IOException: Couldn't lock lock file 
> C:\Users\Reihane\Documents\Neo4j\default.graphdb\lock because another 
> process already holds the lock.
> at 
> org.neo4j.kernel.impl.nioneo.store.FileLock.getLockFileBasedFileLock(FileLock.java:115)
> at 
> org.neo4j.kernel.impl.nioneo.store.FileLock.getOsSpecificFileLock(FileLock.java:63)
> at 
> org.neo4j.kernel.DefaultFileSystemAbstraction.tryLock(DefaultFileSystemAbstraction.java:89)
> at org.neo4j.kernel.StoreLocker.checkLock(StoreLocker.java:74)
> ... 13 more
>
> By removing the line graphdb.shutdown() from my code, now it's working 
> fine with multiple threads. But I'm really curious why this might happen?
>
> You can find the entire conversation here: 
> https://groups.google.com/forum/#!topic/bg-socialbenchmark/NU4ZSVei_Es
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Neo4j" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] <javascript:>.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to