Hi there,
Neo4j in itself is thread safe, so you can pass it around as a
singleton and access it from different Java threads.

The HighlyAvailableGraphDatabase for scaling over multiple machines is
part of neo4j-enterprise, so you need to update your maven
dependencies to change "community" for "enterprise". Does that help?

Cheers,

/peter neubauer

GTalk:      neubauer.peter
Skype       peter.neubauer
Phone       +46 704 106975
LinkedIn   http://www.linkedin.com/in/neubauer
Twitter      http://twitter.com/peterneubauer

http://www.neo4j.org               - Your high performance graph database.
http://startupbootcamp.org/    - Öresund - Innovation happens HERE.
http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.



On Wed, Sep 28, 2011 at 2:26 PM, st.pa <[email protected]> wrote:
>
> hi,
>
> while i was not trying to use threads, everything went fine. now i need
> concurrent java threads to access the same (embedded?) graph database.
> neo4j-manual.pdf for 1.4.1 says in section 1.1.2. that i should use
> HighlyAvailableGraphDatabase, which is no longer there in 1.5.1 as it
> seems. i have not looked into server and rest api yet, so is there a way
> to do a threaded app with say a queue thread and n worker threads inside
> the jvm that all do their own transactions on the same database
> location? the following exception is what i got for assigning the queue
> thread's embedded db to the worker threads, i guess.
>
> Exception in thread "Thread-6" java.lang.RuntimeException:
> java.nio.channels.ClosedByInterruptException
> at
> org.neo4j.index.impl.lucene.LuceneDataSource.getIndexWriter(LuceneDataSource.java:603)
> at
> org.neo4j.index.impl.lucene.LuceneDataSource.getIndexSearcher(LuceneDataSource.java:486)
> at org.neo4j.index.impl.lucene.LuceneIndex.query(LuceneIndex.java:248)
> at
> org.neo4j.index.impl.lucene.LuceneIndex$RelationshipIndex.get(LuceneIndex.java:480)
> at de.stp.DatabaseNeo4j.removeUrlQueue(DatabaseNeo4j.java:777)
> at de.stp.util.BufferNeo4j.next(BufferNeo4j.java:194)
> at de.stp.RoboNeo4j.nächsterSchritt(RoboNeo4j.java:452)
> at de.stp.RoboNeo4j.run(RoboNeo4j.java:436)
> at java.lang.Thread.run(Thread.java:619)
> Caused by: java.nio.channels.ClosedByInterruptException
> at
> java.nio.channels.spi.AbstractInterruptibleChannel.end(AbstractInterruptibleChannel.java:184)
> at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:772)
> at
> org.apache.lucene.store.MMapDirectory$MMapIndexInput.<init>(MMapDirectory.java:225)
> at
> org.apache.lucene.store.MMapDirectory$MMapIndexInput.<init>(MMapDirectory.java:217)
> at org.apache.lucene.store.MMapDirectory.openInput(MMapDirectory.java:209)
> at
> org.apache.lucene.index.CompoundFileReader.<init>(CompoundFileReader.java:66)
> at
> org.apache.lucene.index.CompoundFileReader.<init>(CompoundFileReader.java:55)
> at org.apache.lucene.index.IndexWriter.getFieldInfos(IndexWriter.java:1193)
> at
> org.apache.lucene.index.IndexWriter.getCurrentFieldInfos(IndexWriter.java:1213)
> at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:1149)
> at
> org.neo4j.index.impl.lucene.LuceneDataSource.getIndexWriter(LuceneDataSource.java:590)
>        ... 8 more
>
> Thx for any ideas.
> ciao, st.p.
> _______________________________________________
> Neo4j mailing list
> [email protected]
> https://lists.neo4j.org/mailman/listinfo/user
>
_______________________________________________
Neo4j mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to