void clean() { List<MappingKey> keys = new ArrayList<MappingKey>(buffers.keySet()); for (MappingKey key : keys) { MappedByteBuffer buffer = buffers.remove(key); NIOUtilities.clean(buffer, true); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "Removed mapping for " + key.file.getAbsolutePath()); } } }
/** * This method is called when the user has registered another {@link OperationDescriptor} for an * operation and requires to update the various CoverageProcessors. */ public static synchronized void updateProcessors() { Set<Hints> keySet = processorsPool.keySet(); for (Hints key : keySet) { CoverageProcessor processor = processorsPool.get(key); processor.scanForPlugins(); } }
List<MappingKey> keys = new ArrayList<MappingKey>(buffers.keySet()); for (MappingKey key : keys) { if (key.file.equals(file)) {
@Override public void dispose() { super.dispose(); synchronized (this) { if (coverages != null && !coverages.isEmpty()) { Iterator<String> keysIt = coverages.keySet().iterator(); while (keysIt.hasNext()) { String key = keysIt.next(); CoverageSource sourceCov = coverages.get(key); sourceCov.dispose(); } coverages.clear(); } coverages = null; } if (access != null) { try { access.dispose(); } catch (Throwable t) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, t.getLocalizedMessage(), t); } } } }
/** * This method is called when the user has registered another {@link OperationDescriptor} and * must remove the old operation instance from the processors. * * @param operationName Name of the operation to remove */ public static synchronized void removeOperationFromProcessors(String operationName) { List<String> operations = JAIExt.getJAINames(operationName); Set<Hints> keySet = processorsPool.keySet(); for (Hints key : keySet) { for (String opName : operations) { CoverageProcessor processor = processorsPool.get(key); try { Operation op = processor.getOperation(opName); if (op != null) { processor.removeOperation(op); } } catch (OperationNotFoundException e) { LOGGER.warning("Operation: " + opName + " not found in CoverageProcessor"); } } } }
void clean() { List<MappingKey> keys = new ArrayList<MappingKey>(buffers.keySet()); for (MappingKey key : keys) { MappedByteBuffer buffer = buffers.remove(key); NIOUtilities.clean(buffer, true); if(LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "Removed mapping for " + key.file.getAbsolutePath()); } } }
void clean() { List<MappingKey> keys = new ArrayList<MappingKey>(buffers.keySet()); for (MappingKey key : keys) { MappedByteBuffer buffer = buffers.remove(key); NIOUtilities.clean(buffer, true); if(LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "Removed mapping for " + key.file.getAbsolutePath()); } } }
/** * Cleans up all memory mapped regions for a specified file. It is necessary to call this * method before any attempt to open a file for writing on Windows * @param file */ void cleanFileCache(URL url) { try { final File rawFile = DataUtilities.urlToFile(url); if(rawFile == null) { // not a local file return; } File file = rawFile.getCanonicalFile(); List<MappingKey> keys = new ArrayList<MappingKey>(buffers.keySet()); for (MappingKey key : keys) { if(key.file.equals(file)) { MappedByteBuffer buffer = buffers.remove(key); NIOUtilities.clean(buffer, true); if(LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "Removed mapping for " + file.getAbsolutePath()); } } } } catch(Throwable t) { LOGGER.log(Level.WARNING, "An error occurred while trying to clean the memory map cache", t); } }
/** * Cleans up all memory mapped regions for a specified file. It is necessary to call this * method before any attempt to open a file for writing on Windows * @param file */ void cleanFileCache(URL url) { try { final File rawFile = DataUtilities.urlToFile(url); if(rawFile == null) { // not a local file return; } File file = rawFile.getCanonicalFile(); List<MappingKey> keys = new ArrayList<MappingKey>(buffers.keySet()); for (MappingKey key : keys) { if(key.file.equals(file)) { MappedByteBuffer buffer = buffers.remove(key); NIOUtilities.clean(buffer, true); if(LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "Removed mapping for " + file.getAbsolutePath()); } } } } catch(Throwable t) { LOGGER.log(Level.WARNING, "An error occurred while trying to clean the memory map cache", t); } }
@Override public void dispose() { super.dispose(); synchronized (this) { if (coverages != null && !coverages.isEmpty()) { Iterator<String> keysIt = coverages.keySet().iterator(); while (keysIt.hasNext()) { String key = keysIt.next(); CoverageSource sourceCov = coverages.get(key); sourceCov.dispose(); } coverages.clear(); } coverages = null; } if (access != null) { try { access.dispose(); } catch (Throwable t) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, t.getLocalizedMessage(), t); } } } }