protected void removeEnv(String envKey) { synchronized (envs) { Environment env = envs.remove(envKey); if (env != null) env.close(); } }
@Listen public void on(SystemStopping event) { synchronized (envs) { for (Environment env: envs.values()) env.close(); envs.clear(); } }
if (this.log.isDebugEnabled()) this.log.debug("stopping Xodus database " + this); this.env.close(); } catch (Throwable e) { this.log.error("caught exception closing database during shutdown (ignoring)", e);
@Override public void teardown() throws IOException { reportSpaceBeforeClose(); env.close(); super.teardown(); }
private synchronized void open() { final File loc = ProjectDatabase.getInstance().getBaseLocation(); if (nonNull(this.baseLocation) && !this.baseLocation.equals(loc)) { // change database if (nonNull(this.searcher)) { this.searcher.close(); this.searcher = null; } if (nonNull(this.environment)) { this.environment.close(); this.environment = null; } } if (isNull(this.environment)) { File env = new File(loc, "index"); this.environment = Environments.newContextualInstance(env); String location = this.environment.getLocation(); log.debug("open index database {}", location); try { this.searcher = new DocumentSearcher((ContextualEnvironment) this.environment); } catch (IOException e) { throw new UncheckedIOException(e); } } }
@Override public void close( ) throws LocalDBException { if ( environment != null && environment.isOpen() ) { environment.close(); try { Files.deleteIfExists( getDirtyFile().toPath() ); LOGGER.trace( () -> "deleted openLock file" ); } catch ( IOException e ) { LOGGER.error( "error creating openLock file: " + e.getMessage() ); } } status = LocalDB.Status.CLOSED; LOGGER.debug( () -> "closed" ); }
private synchronized void close() { if (nonNull(this.entityStore)) { try { EnvironmentImpl environment = (EnvironmentImpl) this.entityStore.getEnvironment(); environment.flushAndSync(); this.entityStore.close(); } catch (ExodusException e) { // wait transaction try { Thread.sleep(1000 * 3); } catch (InterruptedException e1) { log.catching(e1); } this.entityStore.close(); } this.entityStore = null; } if (nonNull(this.environment)) { this.environment.close(); this.environment = null; } }
public static void reset() { if (projectDatabase != null) { if (nonNull(projectDatabase.entityStore)) { try { EnvironmentImpl environment = (EnvironmentImpl) projectDatabase.entityStore.getEnvironment(); environment.flushAndSync(); projectDatabase.entityStore.close(); } catch (ExodusException e) { // wait transaction try { Thread.sleep(1000 * 3); } catch (InterruptedException e1) { log.catching(e1); } projectDatabase.entityStore.close(); } projectDatabase.entityStore = null; } if (nonNull(projectDatabase.environment)) { projectDatabase.environment.close(); projectDatabase.environment = null; } projectDatabase.open(); } }