/** Destroys the helper by cleaning all the in memory objects. */ public void destroy() { if (graphPool != null) { for (OrientBaseGraph graph : graphPool.getResources()) { graph.shutdown(); } graphPool.close(); } }
protected void dbClient1() { // OGlobalConfiguration.LOG_CONSOLE_LEVEL.setValue("FINEST"); OrientBaseGraph graph = new OrientGraph(getLocalURL()); OrientVertex vertex1 = graph.addVertex("vertextype", (String) null); graph.commit(); graph.shutdown(); vertex1Id = vertex1.getIdentity(); exec("client1"); }
protected void exec(final String iClient) { counter.countDown(); try { counter.await(); } catch (InterruptedException e) { e.printStackTrace(); } OrientBaseGraph graph = new OrientGraph(getLocalURL()); OrientVertex vertex1 = graph.getVertex(vertex1Id); try { int i = 0; for (; i < TOTAL; ++i) { for (int retry = 0; retry < 20; ++retry) { try { OrientVertex vertex2 = graph.addVertex("vertextype", (String) null); vertex1.addEdge("edgetype", vertex2); graph.commit(); System.out.println( iClient + " - successfully committed version: " + vertex1.getRecord().getVersion()); } catch (ONeedRetryException e) { System.out.println( iClient + " - caught conflict, reloading vertex. v=" + vertex1.getRecord().getVersion()); vertex1.reload(); } } } // STATISTICALLY HERE AT LEAST ON CONFLICT HAS BEEN RECEIVED vertex1.reload(); Assert.assertTrue(vertex1.getRecord().getVersion() > TOTAL * 2 + 1); Assert.assertEquals(TOTAL, i); } catch (Throwable e) { if (exceptionInThread == null) exceptionInThread = e; } finally { System.out.println("Shutting down"); graph.shutdown(); sleep(1000); } }