@Override
  @CanIgnoreReturnValue
  public FileChannel position(long newPosition) throws IOException {
    Util.checkNotNegative(newPosition, "newPosition");
    checkOpen();

    synchronized (this) {
      boolean completed = false;
      try {
        begin(); // don't call beginBlocking() because this method doesn't block
        if (!isOpen()) {
          return this; // AsynchronousCloseException will be thrown
        }
        this.position = newPosition;
        completed = true;
      } finally {
        end(completed);
      }
    }

    return this;
  }
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