public void release(MappedMemory mappedMemory) { if (mappedMemory.release()) { if (map0 == mappedMemory) map0 = null; if (map1 == mappedMemory) map1 = null; } } }
public void release(MappedMemory mappedMemory) { if (mappedMemory.release()) { if (map0 == mappedMemory) map0 = null; if (map1 == mappedMemory) map1 = null; } } }
public static void release(MappedMemory mapmem) { if (mapmem != null) mapmem.release(); }
public static void release(MappedMemory mapmem) { if (mapmem != null) mapmem.release(); }
public synchronized void close() throws IOException { if (map1 != null) { map1.release(); map1 = null; } if (map0 != null) { map0.release(); map0 = null; } // clean up errant maps. int count = 0; for (int i = maps.size() - 1; i >= 0; i--) { if (maps.get(i).refCount() <= 0) { maps.get(i).close(); count++; } } if (count > 1) { LoggerFactory.getLogger(MappedFile.class).info("{} memory mappings left unreleased, num= {}", filename, count); } maps.clear(); fileChannel.close(); }
public synchronized void close() throws IOException { if (map1 != null) { map1.release(); map1 = null; } if (map0 != null) { map0.release(); map0 = null; } // clean up errant maps. int count = 0; for (int i = maps.size() - 1; i >= 0; i--) { if (maps.get(i).refCount() <= 0) { maps.get(i).close(); count++; } } if (count > 1) { LoggerFactory.getLogger(MappedFile.class).info("{} memory mappings left unreleased, num= {}", filename, count); } maps.clear(); fileChannel.close(); }
private synchronized MappedMemory acquire0(long index) throws IOException { if (map1 != null) map1.release(); map1 = map0; map0 = new MappedMemory(fileChannel.map(FileChannel.MapMode.READ_WRITE, index * blockSize, blockSize + overlapSize), index); map0.reserve(); maps.add(map0); // clean up duds. for (int i = maps.size() - 1; i >= 0; i--) { if (maps.get(i).refCount() <= 0) maps.remove(i); } return map0; }
private synchronized MappedMemory acquire0(long index) throws IOException { if (map1 != null) map1.release(); map1 = map0; map0 = new MappedMemory(fileChannel.map(FileChannel.MapMode.READ_WRITE, index * blockSize, blockSize + overlapSize), index); map0.reserve(); maps.add(map0); // clean up duds. for (int i = maps.size() - 1; i >= 0; i--) { if (maps.get(i).refCount() <= 0) maps.remove(i); } return map0; }