コード例 #1
0
ファイル: StoreAppend.java プロジェクト: dave68/mapdb
  @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();
    }
  }
コード例 #2
0
 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");
   }
 }
コード例 #3
0
ファイル: StoreWAL.java プロジェクト: jimichan/mapdb
  @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();
    }
  }
コード例 #4
0
  @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");
  }
コード例 #5
0
 /**
  * {@inheritDoc}
  *
  * @see org.castor.cache.Cache#close()
  */
 public void close() {
   _log.debug(getType() + ".close() [" + getName() + "]");
   _cache.close();
 }