@Override public void close() { final Iterator<Map.Entry<T, VanillaMappedBytes>> it = this.cache.entrySet().iterator(); while (it.hasNext()) { Map.Entry<T, VanillaMappedBytes> entry = it.next(); entry.getValue().release(); if (this.cleanOnClose && !entry.getValue().unmapped()) { entry.getValue().cleanup(); entry.getValue().close(); it.remove(); } else if (entry.getValue().unmapped()) { entry.getValue().close(); it.remove(); } } this.cache.clear(); }
@Override public void close() { final Iterator<Map.Entry<T,VanillaMappedBytes>> it = this.cache.entrySet().iterator(); while(it.hasNext()) { Map.Entry<T,VanillaMappedBytes> entry = it.next(); entry.getValue().release(); if(this.cleanOnClose && !entry.getValue().unmapped()) { entry.getValue().cleanup(); entry.getValue().close(); it.remove(); } else if(entry.getValue().unmapped()) { entry.getValue().close(); it.remove(); } } this.cache.clear(); }
public VanillaMappedBytes put(T key, File path, long size, long index) throws IOException { VanillaMappedBytes data = this.cache.get(key); if (data != null) { if (!data.unmapped()) { data.cleanup(); throw new IllegalStateException( "Buffer at " + data.index() + " has a count of " + +data.refCount() ); } } data = VanillaMappedFile.readWriteBytes(path, size, index, fileLifecycleListener); this.cache.put(key, data); return data; }
public VanillaMappedBytes put(T key, File path, long size, long index) throws IOException { VanillaMappedBytes data = this.cache.get(key); if(data != null) { if (!data.unmapped()) { data.cleanup(); throw new IllegalStateException( "Buffer at " + data.index() + " has a count of " + + data.refCount() ); } } data = VanillaMappedFile.readWriteBytes(path, size, index, fileLifecycleListener); this.cache.put(key,data); return data; }
@Override public synchronized void close() throws IOException { if (this.mb0 != null && !this.mb0.unmapped()) { this.mb0.release(); this.mb0 = null; } if (this.mb1 != null && !this.mb1.unmapped()) { this.mb1.release(); this.mb1 = null; } for (int i = bytes.size() - 1; i >= 0; i--) { bytes.get(i).cleanup(); } this.bytes.clear(); this.mappedFile.close(); } }
@Override public synchronized void close() throws IOException { if (this.mb0 != null && !this.mb0.unmapped()) { this.mb0.release(); this.mb0 = null; } if (this.mb1 != null && !this.mb1.unmapped()) { this.mb1.release(); this.mb1 = null; } for (int i = bytes.size() - 1; i >= 0; i--) { bytes.get(i).cleanup(); } this.bytes.clear(); this.mappedFile.close(); }