@Test public void testMappedCache4() throws IOException { VanillaMappedCache<Integer> cache = new VanillaMappedCache(10000, true); VanillaMappedBytes buffer = cache.put(1, newTempraryFile("vmc-4"), 256, 1); buffer.reserve(); assertEquals(2, buffer.refCount()); buffer.release(); assertEquals(1, buffer.refCount()); cache.close(); assertEquals(0, buffer.refCount()); }
@Override public synchronized void close() throws IOException { if (this.fileChannel.isOpen()) { long start = System.nanoTime(); this.fileChannel.close(); this.fileLifecycleListener.onEvent(EventType.CLOSE, this.path, System.nanoTime() - start); } }
VanillaMappedFile implements VanillaMappedResource { @Override public synchronized void close() throws IOException { if (this.fileChannel.isOpen()) { long start = System.nanoTime(); this.fileChannel.close(); this.fileLifecycleListener.onEvent(EventType.CLOSE, this.path, System.nanoTime() - start); } } }
VanillaMappedFile implements VanillaMappedResource { @Override public synchronized void close() throws IOException { if (this.fileChannel.isOpen()) { long start = System.nanoTime(); this.fileChannel.close(); this.fileLifecycleListener.onEvent(EventType.CLOSE, this.path, System.nanoTime() - start); } } VanillaMappedFile(final File path, VanillaMappedMode mode);  VanillaMappedFile(final File path, VanillaMappedMode mode, long size,
                             FileLifecycleListener fileLifecycleListener); }
VanillaMappedFile implements VanillaMappedResource { @Override public synchronized void close() throws IOException { if (this.fileChannel.isOpen()) { long start = System.nanoTime(); this.fileChannel.close(); this.fileLifecycleListener.onEvent(EventType.CLOSE, this.path, System.nanoTime() - start); } } VanillaMappedFile(final File path, VanillaMappedMode mode);  VanillaMappedFile(final File path, VanillaMappedMode mode, long size,
                             FileLifecycleListener fileLifecycleListener); static VanillaMappedFile readWrite(final File path); static VanillaMappedFile readWrite(final File path, long size); static VanillaMappedFile readOnly(final File path); static VanillaMappedFile readOnly(final File path, long size); static VanillaMappedBytes readWriteBytes(final File path, long size); static VanillaMappedBytes readWriteBytes(final File path, long size, long index); static VanillaMappedBytes readWriteBytes(final File path, long size, long index, FileLifecycleListener fileLifecycleListener); VanillaMappedBytes bytes(long address, long size); VanillaMappedBytes bytes(long address, long size, long index); @Override String path(); @Override long size(); @Override synchronized void close(); }
VanillaMappedFile implements VanillaMappedResource { @Override public synchronized void close() throws IOException { if (this.fileChannel.isOpen()) { long start = System.nanoTime(); this.fileChannel.close(); this.fileLifecycleListener.onEvent(EventType.CLOSE, this.path, System.nanoTime() - start); } } VanillaMappedFile(final File path, VanillaMappedMode mode);  VanillaMappedFile(final File path, VanillaMappedMode mode, long size,
                             FileLifecycleListener fileLifecycleListener); static VanillaMappedFile readWrite(final File path); static VanillaMappedFile readWrite(final File path, long size); static VanillaMappedFile readOnly(final File path); static VanillaMappedFile readOnly(final File path, long size); static VanillaMappedBytes readWriteBytes(final File path, long size); static VanillaMappedBytes readWriteBytes(final File path, long size, long index); static VanillaMappedBytes readWriteBytes(final File path, long size, long index, FileLifecycleListener fileLifecycleListener); VanillaMappedBytes bytes(long address, long size); VanillaMappedBytes bytes(long address, long size, long index); @Override String path(); @Override long size(); @Override synchronized void close();  }