@Override public void close() { if (closed) return; commitLock.lock(); try { if (closed) return; if (isSnapshot) { snapshots.remove(this); return; } vol.sync(); vol.close(); indexTable.close(); if (caches != null) { for (Cache c : caches) { c.close(); } Arrays.fill(caches, null); } closed = true; } finally { commitLock.unlock(); } }
public static void closeCache() { try { if (cache != null && !cache.isClosed()) { cache.close(); } } catch (Exception e) { e.printStackTrace(); } try { if (ds != null) ds.disconnect(); } catch (Exception e) { getLogWriter().fine("Error in disconnecting from Distributed System"); } }
@Override public void close() { commitLock.lock(); try { if (closed) { return; } if (hasUncommitedData()) { LOG.warning("Closing storage with uncommited data, this data will be discarded."); } headVol.putData(0, headVolBackup, 0, headVolBackup.length); if (!readonly) { replaySoft(); wal.destroyWalFiles(); } wal.close(); vol.close(); vol = null; headVol.close(); headVol = null; headVolBackup = null; uncommittedStackPages.clear(); if (caches != null) { for (Cache c : caches) { c.close(); } Arrays.fill(caches, null); } if (fileLockHeartbeat != null) { fileLockHeartbeat.unlock(); fileLockHeartbeat = null; } closed = true; } finally { commitLock.unlock(); } }
@Override protected void tearDown() throws Exception { if (region != null) { region.destroyRegion(); } if (hdfsStore != null) { hdfsStore.getFileSystem().delete(testDataDir, true); hdfsStore.destroy(); } if (cache != null) { cache.close(); } super.tearDown(); TestUtils.removeExpectedException("sleep interrupted"); TestUtils.removeExpectedException("java.io.InterruptedIOException"); }
/** * {@inheritDoc} * * @see org.castor.cache.Cache#close() */ public void close() { _log.debug(getType() + ".close() [" + getName() + "]"); _cache.close(); }