I created example to reproduce. On 2.1-rc3 it hangs in several seconds

final ODatabaseDocumentTx db = new 
ODatabaseDocumentTx("memory:default").open("admin", "admin");
final OrientGraphNoTx graph = new OrientGraphNoTx(db);
final OrientVertexType c1 = graph.createVertexType("C1");
c1.createProperty("p1", OType.INTEGER);
c1.createIndex("p1", "unique", "p1");

final List<Thread> threads = new ArrayList<>();
final Random random = new Random();
final AtomicInteger count = new AtomicInteger();
for (int i = 0; i < 50; i++) {
    final Thread thread = new Thread(new Runnable() {
        @Override
        public void run() {
            for (int j = 0; j < 1000; j++) {
                final ODatabaseDocumentTx db = new 
ODatabaseDocumentTx("memory:default").open("admin", "admin");
                final OrientGraph graph = new OrientGraph(db);
                graph.begin();
                final OrientVertex result = graph.addVertex("class:C1");
                result.setProperty("p1", random.nextInt());

                final OIndex<?> index = 
db.getMetadata().getIndexManager().getIndex("p1");
                for (int k = 0; k < 100; k++) {
                    index.get(random.nextInt());
                }

                graph.shutdown(true, true);
                if (count.incrementAndGet() % 100 == 0) {
                    System.out.print('.');
                    if (count.get() % 10000 == 0) {
                        System.out.println();
                    }
                }
            }
        }
    });
    threads.add(thread);
    thread.start();
}
try {
    for (Thread thread : threads) {
        thread.join();
    }
} catch (InterruptedException e) {
}



-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" 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/d/optout.

Reply via email to