private void checkLockArguments(long position, long size, boolean shared) throws IOException {
    Util.checkNotNegative(position, "position");
    Util.checkNotNegative(size, "size");
    checkOpen();
    if (shared) {
      checkReadable();
    } else {
      checkWritable();
    }
  }
Ends a blocking operation, throwing an exception if the thread was interrupted while blocking
or if the channel was closed from another thread.
jimfs/src/main/java/com/google/common/jimfs/JimfsFileChannel.java