@Override public boolean executeOperation(BlobStore store, Object... objs) throws StorageException { store.destroy(); return true; } },
private void destroy(Map<String, LiveStore> blobStores) { for (LiveStore bs : blobStores.values()) { try { if (bs.config.isEnabled()) { bs.liveInstance.destroy(); } } catch (Exception e) { log.error("Error disposing BlobStore " + bs.config.getName(), e); } } blobStores.clear(); }
public void setBlobStores(Iterable<? extends BlobStoreInfo> configs) throws StorageException, ConfigurationException { configLock.writeLock().lock(); try { Map<String, LiveStore> newStores = loadBlobStores(configs); Map<String, LiveStore> oldStores = this.blobStores; this.blobStores = newStores; for (LiveStore ls : oldStores.values()) { if (ls.liveInstance != null) { ls.liveInstance.destroy(); } } } finally { configLock.writeLock().unlock(); } }
@Override public synchronized void destroy() { if (configured.getAndSet(false)) { // Avoid to call the While cycle before having started an operation // with configured == true actualOperations.incrementAndGet(); actualOperations.decrementAndGet(); // Wait until all the operations are finished while (actualOperations.get() > 0) {} // Destroy all super.destroy(); delegate.destroy(); cache.reset(); } }
/** * Override and add tear down assertions after calling super * * @throws Exception */ @After public void destroyTestUnit() throws Exception { // Might be null if an Assumption failed during createTestUnit if (Objects.nonNull(store)) { store.destroy(); } }
@Override protected void tearDown() throws Exception { if (fbs != null) { fbs.destroy(); } File fh = new File(StorageBrokerTest.findTempDir() + File.separator + TEST_BLOB_DIR_NAME); if (fh.exists()) { FileUtils.deleteDirectory(fh); if (fh.exists()) { System.out.println( "Unable to delete " + org.geowebcache.util.FileUtils.printFileTree(fh)); fail("Could not cleanup blob store directory"); } } }
@After public void destroyBlobStores() { if (mbs != null) { mbs.destroy(); } if (nbs != null) { nbs.destroy(); } if (fbs != null) { fbs.destroy(); } }