@Override public FileLock lock(long position, long size, boolean shared) throws IOException { checkLockArguments(position, size, shared); // lock is interruptible boolean completed = false; try { begin(); completed = true; return new FakeFileLock(this, position, size, shared); } finally { try { end(completed); } catch (ClosedByInterruptException e) { throw new FileLockInterruptionException(); } } }
@Override public FileLock tryLock(long position, long size, boolean shared) throws IOException { checkLockArguments(position, size, shared); // tryLock is not interruptible return new FakeFileLock(this, position, size, shared); }
@Override public FileLock tryLock(long position, long size, boolean shared) throws IOException { Util.checkNotNegative(position, "position"); Util.checkNotNegative(size, "size"); channel.checkOpen(); if (shared) { channel.checkReadable(); } else { channel.checkWritable(); } return new JimfsFileChannel.FakeFileLock(this, position, size, shared); }
@Override public FileLock lock(long position, long size, boolean shared) throws IOException { checkLockArguments(position, size, shared); // lock is interruptible boolean completed = false; try { begin(); completed = true; return new FakeFileLock(this, position, size, shared); } finally { try { end(completed); } catch (ClosedByInterruptException e) { throw new FileLockInterruptionException(); } } }
@Override public FileLock tryLock(long position, long size, boolean shared) throws IOException { checkLockArguments(position, size, shared); // tryLock is not interruptible return new FakeFileLock(this, position, size, shared); }
@Override public FileLock tryLock(long position, long size, boolean shared) throws IOException { Util.checkNotNegative(position, "position"); Util.checkNotNegative(size, "size"); channel.checkOpen(); if (shared) { channel.checkReadable(); } else { channel.checkWritable(); } return new JimfsFileChannel.FakeFileLock(this, position, size, shared); }