public void close() { if (db != null) { activateOnCurrentThread(); db.close(); } DBUtil.closeDataStore(); }
@Override public void close() { db.close(); closed = true; }
public void forceClose() { super.close(); }
@Override public void close() { db.close(); db = null; }
@Override public void close() { db.close(); }
@Override protected void doStart() throws Exception { // ensure the database is created databaseManager.connect(name, true).close(); }
public void close() throws OdaException { if (db!=null && !db.isClosed()){ db.close(); } db = null; m_isOpen = false; }
@Override protected void doStart() { // make sure the db exists and init connection pool databaseManager.connect(DB_NAME, true).close(); databasePool = databaseManager.pool(DB_NAME); }
public void close() { if (db != null) { activateOnCurrentThread(); db.close(); } DBUtil.closeDataStore(); }
@Override @Transitions(from = {OPEN, ACTIVE}, to = CLOSED) public void close() { // If the transaction has not been committed, then we roll back. if (ACTIVE.equals(stateGuard.getCurrent())) { rollback(); } db.close(); // rolls back and releases ODatabaseDocumentTx to pool }
private void removeContext() { final OrientGraphContext context = getContext(false); if (context != null) { for (Index<? extends Element> idx : context.manualIndices.values()) ((OrientIndex<?>) idx).close(); context.manualIndices.clear(); if (!context.rawGraph.isClosed()) { context.rawGraph.commit(); context.rawGraph.close(); } synchronized (contexts) { contexts.remove(context); } threadContext.set(null); } }
@Override public void exportGraph(String outputDirectory) throws IOException { if (log.isDebugEnabled()) { log.debug("Running export to {" + outputDirectory + "} directory."); } ODatabaseDocumentTx db = factory.getDatabase(); try { OCommandOutputListener listener = new OCommandOutputListener() { @Override public void onMessage(String iText) { System.out.println(iText); } }; String dateString = formatter.format(new Date()); String exportFile = "export_" + dateString; new File(outputDirectory).mkdirs(); ODatabaseExport export = new ODatabaseExport(db, new File(outputDirectory, exportFile).getAbsolutePath(), listener); export.exportDatabase(); export.close(); } finally { db.close(); } }
@Override public void start(final String database) { // test connection and let orient configure database new OrientGraph( (ODatabaseDocumentInternal) orientDB.get() .open(database, userManager.getUser(), userManager.getPassword())) .getRawGraph().close(); logger.debug("Pool {} started for database '{}'", getType(), database); }
/** * build and/or update my schema */ public void buildOrUpdateSchema() { // get version of database int versionLocal = getConfigVersion(); // no version update needed => just return if (versionLocal >= CURRENT_VERSION) return; // open database ODatabaseDocumentTx db = orientGraphFactory.getDatabase(); // run schema update scripts per version number for (int i = versionLocal; i < CURRENT_VERSION; i++) runSchemaScript("/orientdb/schema_version_" + i + ".sql", db); // close db db.close(); }
@Override public void restore(String backupFile) throws IOException { if (log.isDebugEnabled()) { log.debug("Running restore using {" + backupFile + "} backup file."); } ODatabaseDocumentTx db = factory.getDatabase(); try { OCommandOutputListener listener = new OCommandOutputListener() { @Override public void onMessage(String iText) { System.out.println(iText); } }; try (InputStream in = new FileInputStream(backupFile)) { db.restore(in, null, null, listener); } } finally { db.close(); } }
@Override public void importGraph(String importFile) throws IOException { ODatabaseDocumentTx db = factory.getDatabase(); try { OCommandOutputListener listener = new OCommandOutputListener() { @Override public void onMessage(String iText) { System.out.println(iText); } }; ODatabaseImport databaseImport = new ODatabaseImport(db, importFile, listener); databaseImport.importDatabase(); databaseImport.close(); } finally { db.close(); } } }
@Override protected boolean nextInner() throws IOException { ODatabaseDocumentTx loadTx = ((OrientDBStore<K, T>) getDataStore()) .getConnectionPool().acquire(); loadTx.activateOnCurrentThread(); try { if (!resultSetIterator.hasNext()) { return false; } ODocument obj = resultSetIterator.next(); key = (K) obj.field("_id"); persistent = ((OrientDBStore<K, T>) getDataStore()) .convertOrientDocToAvroBean(obj, getQuery().getFields()); return persistent != null; } finally { loadTx.close(); } }
@Override public void onAfterServerStartupAndActivation(OrientDbWebApplication app) throws Exception { IOrientDbSettings settings = app.getOrientDbSettings(); ODatabaseDocumentTx db = new ODatabaseDocumentTx(settings.getDBUrl()); if(!db.exists()) { db = db.create(); onDbCreated(db, settings); } if(db.isClosed()) db.open(settings.getAdminUserName(), settings.getAdminPassword()); db.getMetadata().load(); db.close(); }
@Override public void onAfterServerStartupAndActivation(OrientDbWebApplication app) throws Exception { IOrientDbSettings settings = app.getOrientDbSettings(); ODatabaseDocumentTx db = new ODatabaseDocumentTx(DB_MEMORY_URL); if(!db.exists()) db = db.create(); if(db.isClosed()) db.open(settings.getAdminUserName(), settings.getAdminPassword()); db.getMetadata().load(); db.close(); }