<T> T executeOp(final @NotNull Path path,
                  final @NotNull FileChannelOperation<T> operation,
                  final boolean read) throws IOException {
    ChannelDescriptor descriptor;
    synchronized (myCacheLock) {
      descriptor = myCache.get(path);
      if (descriptor == null) {
        boolean somethingDropped = releaseOverCachedChannels();
        descriptor = new ChannelDescriptor(path, read);
        myCache.put(path, descriptor);
        if (somethingDropped) {
          myMissCount++;
        }
        else {
          myLoadCount++;
        }
      }
      else if (!read && descriptor.isReadOnly()) {
        if (descriptor.isLocked()) {
          descriptor = new ChannelDescriptor(path, false);
        }
        else {
          // re-open as write
          closeChannel(path);
          descriptor = new ChannelDescriptor(path, false);
          myCache.put(path, descriptor);
        }
        myMissCount++;
      }
      else {
        myHitCount++;
      }
      descriptor.lock();
    }

    //channel access is NOT guarded by the myCacheLock
    try {
      return operation.execute(descriptor.channel());
    }
    finally {
      synchronized (myCacheLock) {
        descriptor.unlock();
      }
    }
  }
<T> T executeOp(final @NotNull Path path,
                  final @NotNull FileChannelOperation<T> operation,
                  final boolean read)