@Override public boolean release() { if (!unmapped()) { return super.release(); } return false; }
@Override public boolean release() { if(!unmapped()) { return super.release(); } return false; }
@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(); }
protected VanillaMappedBytes acquire0(long index) throws IOException { if (this.mb1 != null) { this.mb1.release(); } this.mb1 = this.mb0; this.mb0 = this.mappedFile.bytes(index * this.blockSize, this.blockSize, index); this.mb0.reserve(); bytes.add(this.mb0); for (int i = bytes.size() - 1; i >= 0; i--) { if (bytes.get(i).unmapped()) { bytes.remove(i); } } return this.mb0; }
@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(); }
protected VanillaMappedBytes acquire0(long index) throws IOException { if (this.mb1 != null) { this.mb1.release(); } this.mb1 = this.mb0; this.mb0 = this.mappedFile.bytes(index * this.blockSize, this.blockSize, index); this.mb0.reserve(); bytes.add(this.mb0); for (int i = bytes.size() - 1; i >= 0; i--) { if (bytes.get(i).unmapped()) { bytes.remove(i); } } return this.mb0; }
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; }