@Override public String getURL() { return url != null ? url : getStorage().getURL(); }
/** * Removes from memory the pool associated to the closed storage. This avoids pool open against closed storages. */ public void onStorageUnregistered(final OStorage iStorage) { final String storageURL = iStorage.getURL(); lock(); try { Set<String> poolToClose = null; for (Entry<String, OReentrantResourcePool<String, DB>> e : pools.entrySet()) { final int pos = e.getKey().indexOf("@"); final String dbName = e.getKey().substring(pos + 1); if (storageURL.equals(dbName)) { if (poolToClose == null) poolToClose = new HashSet<String>(); poolToClose.add(e.getKey()); } } if (poolToClose != null) for (String pool : poolToClose) remove(pool); } finally { unlock(); } }
public ODatabaseDocumentEmbedded(final OStorage storage) { activateOnCurrentThread(); try { status = STATUS.CLOSED; // OVERWRITE THE URL url = storage.getURL(); this.storage = storage; this.componentsFactory = storage.getComponentsFactory(); unmodifiableHooks = Collections.unmodifiableMap(hooks); localCache = new OLocalRecordCache(); init(); databaseOwner = this; } catch (Exception t) { ODatabaseRecordThreadLocal.instance().remove(); throw OException.wrapException(new ODatabaseException("Error on opening database "), t); } }