@Override
  public ListenableFuture<FileLock> lock(
      final long position, final long size, final boolean shared) {
    Util.checkNotNegative(position, "position");
    Util.checkNotNegative(size, "size");
    if (!isOpen()) {
      return closedChannelFuture();
    }
    if (shared) {
      channel.checkReadable();
    } else {
      channel.checkWritable();
    }
    return executor.submit(
        new Callable<FileLock>() {
          @Override
          public FileLock call() throws IOException {
            return tryLock(position, size, shared);
          }
        });
  }
{@link AsynchronousFileChannel} implementation that delegates to a {@link JimfsFileChannel}.

@author Colin Decker
jimfs/src/main/java/com/google/common/jimfs/JimfsAsynchronousFileChannel.java