@Test public void testGetBeginning() { try { String file = FileOps.tempFile(); int value = Random.getInt(); FileChannel channel = FileChannel.open(new File(file).toPath(), StandardOpenOption.CREATE, StandardOpenOption.READ, StandardOpenOption.WRITE); channel.write(getByteBuffer(value)); for (int i = 0; i < Random.getScaleCount(); ++i) { channel.write(getByteBuffer(Random.getInt())); } MappedAtomicInteger integer = new MappedAtomicInteger(channel); for (int i = 0; i < Random.getScaleCount(); ++i) { Assert.assertEquals(value, integer.get()); } } catch (IOException e) { throw CheckedExceptions.wrapAsRuntimeException(e); } }
public int get() { FileLock lock = lock(); try { return getUnsafe(); } finally { FileLocks.release(lock); } }
MappedAtomicInteger { public int get() { FileLock lock = lock(); try { return getUnsafe(); } finally { FileLocks.release(lock); } } }
MappedAtomicInteger { public int get() { FileLock lock = lock(); try { return getUnsafe(); } finally { FileLocks.release(lock); } } MappedAtomicInteger(FileChannel channel);  MappedAtomicInteger(FileChannel channel, int position);  MappedAtomicInteger(String address);  MappedAtomicInteger(String address, int position); }
MappedAtomicInteger { public int get() { FileLock lock = lock(); try { return getUnsafe(); } finally { FileLocks.release(lock); } } MappedAtomicInteger(FileChannel channel);  MappedAtomicInteger(FileChannel channel, int position);  MappedAtomicInteger(String address);  MappedAtomicInteger(String address, int position); int addAndGet(int amount); @Override void finalize(); int get(); void set(int value); void setAndSync(int value); void sync(); }
MappedAtomicInteger { public int get() { FileLock lock = lock(); try { return getUnsafe(); } finally { FileLocks.release(lock); } } MappedAtomicInteger(FileChannel channel);  MappedAtomicInteger(FileChannel channel, int position);  MappedAtomicInteger(String address);  MappedAtomicInteger(String address, int position); int addAndGet(int amount); @Override void finalize(); int get(); void set(int value); void setAndSync(int value); void sync();  }