/** * Stops and removes all volume scanners.<p/> * * This function will block until all the volume scanners have stopped. */ public synchronized void removeAllVolumeScanners() { for (Entry<String, VolumeScanner> entry : scanners.entrySet()) { entry.getValue().shutdown(); } for (Entry<String, VolumeScanner> entry : scanners.entrySet()) { Uninterruptibles.joinUninterruptibly(entry.getValue(), 5, TimeUnit.MINUTES); } scanners.clear(); }
/** * Stops and removes a volume scanner.<p/> * * This function will block until the volume scanner has stopped. * * @param volume The volume to remove. */ public synchronized void removeVolumeScanner(FsVolumeSpi volume) { if (!isEnabled()) { LOG.debug("Not removing volume scanner for {}, because the block " + "scanner is disabled.", volume.getStorageID()); return; } VolumeScanner scanner = scanners.get(volume.getStorageID()); if (scanner == null) { LOG.warn("No scanner found to remove for volumeId {}", volume.getStorageID()); return; } LOG.info("Removing scanner for volume {} (StorageID {})", volume, volume.getStorageID()); scanner.shutdown(); scanners.remove(volume.getStorageID()); Uninterruptibles.joinUninterruptibly(scanner, 5, TimeUnit.MINUTES); }
/** * Stops and removes all volume scanners.<p/> * * This function will block until all the volume scanners have stopped. */ public synchronized void removeAllVolumeScanners() { for (Entry<String, VolumeScanner> entry : scanners.entrySet()) { entry.getValue().shutdown(); } for (Entry<String, VolumeScanner> entry : scanners.entrySet()) { Uninterruptibles.joinUninterruptibly(entry.getValue(), 5, TimeUnit.MINUTES); } scanners.clear(); }
/** * Stops and removes all volume scanners.<p/> * * This function will block until all the volume scanners have stopped. */ public synchronized void removeAllVolumeScanners() { for (Entry<String, VolumeScanner> entry : scanners.entrySet()) { entry.getValue().shutdown(); } for (Entry<String, VolumeScanner> entry : scanners.entrySet()) { Uninterruptibles.joinUninterruptibly(entry.getValue(), 5, TimeUnit.MINUTES); } scanners.clear(); }
/** * Stops and removes a volume scanner.<p/> * * This function will block until the volume scanner has stopped. * * @param volume The volume to remove. */ public synchronized void removeVolumeScanner(FsVolumeSpi volume) { if (!isEnabled()) { LOG.debug("Not removing volume scanner for {}, because the block " + "scanner is disabled.", volume.getStorageID()); return; } VolumeScanner scanner = scanners.get(volume.getStorageID()); if (scanner == null) { LOG.warn("No scanner found to remove for volumeId {}", volume.getStorageID()); return; } LOG.info("Removing scanner for volume {} (StorageID {})", volume.getBasePath(), volume.getStorageID()); scanner.shutdown(); scanners.remove(volume.getStorageID()); Uninterruptibles.joinUninterruptibly(scanner, 5, TimeUnit.MINUTES); }
/** * Stops and removes a volume scanner.<p/> * * This function will block until the volume scanner has stopped. * * @param volume The volume to remove. */ public synchronized void removeVolumeScanner(FsVolumeSpi volume) { if (!isEnabled()) { LOG.debug("Not removing volume scanner for {}, because the block " + "scanner is disabled.", volume.getStorageID()); return; } VolumeScanner scanner = scanners.get(volume.getStorageID()); if (scanner == null) { LOG.warn("No scanner found to remove for volumeId {}", volume.getStorageID()); return; } LOG.info("Removing scanner for volume {} (StorageID {})", volume.getBasePath(), volume.getStorageID()); scanner.shutdown(); scanners.remove(volume.getStorageID()); Uninterruptibles.joinUninterruptibly(scanner, 5, TimeUnit.MINUTES); }