/** * Closes the Graph. After closing the Graph cannot be used. */ public void shutdown(boolean closeDb) { shutdown(closeDb, true); }
/** * Closes the Graph. After closing the Graph cannot be used. */ public void shutdown() { shutdown(true); }
@Override public void close() { if (graph != null) graph.shutdown(); } }
public void releaseGraph(final OrientBaseGraph graph) { graph.shutdown(false); }
public void shutdown() { graph.shutdown(); }
@Override public void end() { final OrientBaseGraph g = currentGraph.get(); if (g != null) { if (!txAlreadyBegun) { g.commit(); if (shutdownFlag.getValue()) g.shutdown(false); } } }
@Override public void end() { final OrientBaseGraph g = currentGraph.get(); if (g != null) { if (!txAlreadyBegun) { g.commit(); if (shutdownFlag.getValue()) g.shutdown(false, false); } } }
graph.shutdown(false, false);
public static <T> T runWithAnyGraph(final GraphCallBack<T> callBack) { final OModifiableBoolean shutdownFlag = new OModifiableBoolean(); final ODatabaseDocumentInternal curDb = ODatabaseRecordThreadLocal.instance().get(); final OrientBaseGraph graph = OGraphCommandExecutorSQLFactory.getAnyGraph(shutdownFlag); try { return callBack.call(graph); } finally { if (shutdownFlag.getValue()) graph.shutdown(false, false); ODatabaseRecordThreadLocal.instance().set(curDb); } }
public void runImport(String inputFile, String dbURL) throws IOException, FileNotFoundException { if (inputFile == null) throw new OSystemException("needed an input file as first argument"); if (dbURL == null) throw new OSystemException("needed an database location as second argument"); ODatabaseDocumentInternal db = new ODatabaseDocumentTx(dbURL); ODatabaseHelper.deleteDatabase(db, db.getType()); OrientBaseGraph g = OrientGraphFactory.getNoTxGraphImplFactory().getGraph(dbURL); System.out.println("Importing graph from file '" + inputFile + "' into database: " + g + "..."); final long startTime = System.currentTimeMillis(); OConsoleDatabaseApp console = new OGremlinConsole(new String[] { "import database " + inputFile }) .setCurrentDatabase(g.getRawGraph()); console.run(); System.out.println("Imported in " + (System.currentTimeMillis() - startTime) + "ms. Vertexes: " + g.countVertices()); g.command(new OCommandSQL("alter database TIMEZONE 'GMT'")).execute(); g.command(new OCommandSQL("alter database LOCALECOUNTRY 'UK'")).execute(); g.command(new OCommandSQL("alter database LOCALELANGUAGE 'EN'")).execute(); g.shutdown(); } }
public static <T> T runInConfiguredTxMode(final GraphCallBack<T> callBack) { final OModifiableBoolean shutdownFlag = new OModifiableBoolean(); final ODatabaseDocumentInternal curDb = ODatabaseRecordThreadLocal.instance().get(); final boolean txAlreadyBegun = curDb.getTransaction().isActive(); OrientBaseGraph graph = null; try { if (isTxRequiredForSQLGraphOperations()) { graph = OGraphCommandExecutorSQLFactory.getGraph(true, shutdownFlag); return runInTx((OrientGraph) graph, callBack); } else { graph = getAnyGraph(shutdownFlag); return callBack.call(graph); } } finally { if (graph != null) { if (!txAlreadyBegun) { graph.commit(); if (shutdownFlag.getValue()) graph.shutdown(false, false); } } ODatabaseRecordThreadLocal.instance().set(curDb); } }
graphDatabase.shutdown(); break;