OS: OS X 10.6.8
JVM 1.7
Language: java
Neo4J 2.0 CE

I am experiencing a hang when creating a relationship. It only happens when 
NIO MappedByteBuffer is involved. If one moves the contents of the method 
hang inside the constructor Main the hang does not occur.

Are there any restrictions on combining Neo and NIO?

The db is in a different directory where the MappedByteBuffer is but they 
share the same parent directory.

Exclusion problem maybe?


Thanks a lot!!!


Code:

package sandbox;

import java.io.File;

import java.io.IOException;

import java.nio.MappedByteBuffer;

import org.neo4j.graphdb.GraphDatabaseService;

import org.neo4j.graphdb.Label;

import org.neo4j.graphdb.Node;

import org.neo4j.graphdb.RelationshipType;

import org.neo4j.graphdb.Transaction;

import org.neo4j.graphdb.factory.GraphDatabaseFactory;

import org.neo4j.graphdb.DynamicLabel;



class Main{

private Node root;

private GraphDatabaseService graph;

 
 private static enum Relationships implements RelationshipType{ CONTAINS };


 Main() throws IOException{

File location;

 Transaction t = null;

 try{

  location = new File("location");

  if (location.isFile())

  location.renameTo(new File(location.getName() + '.' + 
System.currentTimeMillis()));

  if (!location.exists())

  location.mkdirs();

  graph = newGraphDatabaseFactory().newEmbeddedDatabase(location.getPath());

  t = graph.beginTx();

  root = graph.createNode();

t.success();

 }

 catch(Exception e){

  if (graph != null)

  graph.shutdown(); 

 throw new IOException("Could NOT start storage");

 }

  }

 

 public void shutDown(){

 graph.shutdown();

 }


public void hang(MappedByteBuffer m) {

 Node gn;

 Transaction t = graph.beginTx();

 Label l = DynamicLabel.label("test");

 try{

  if (!root.hasLabel(l)){

  gn = graph.createNode();

  root.createRelationshipTo(gn, Relationships.CONTAINS);  

  }

 }

 finally{

  t.close();

 }

  t.success();

 }

 

 public static void main(String[] args){

 Main m;

 try {

 m = new Main();

  m.shutDown();

 } catch (IOException e) {

 e.printStackTrace();

 }

 }

}

-- 
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