code: public boolean isLockSupported(int idx) throws IOException {
      StorageDirectory sd = storageDirs.get(idx);
      FileLock firstLock = null;
      FileLock secondLock = null;
      try {
        firstLock = sd.lock;
        if(firstLock == null) {
          firstLock = sd.tryLock();
          if(firstLock == null)
            return true;
        }
        secondLock = sd.tryLock();
        if(secondLock == null)
          return true;
      } finally {
        if(firstLock != null && firstLock != sd.lock) {
          firstLock.release();
          firstLock.channel().close();
        }
        if(secondLock != null) {
          secondLock.release();
          secondLock.channel().close();
        }
      }
      return false;
    }
docs: Check whether underlying file system supports file locking.
  
  @return <code>true</code> if exclusive locks are supported or
  <code>false</code> otherwise.
  @throws IOException
  @see StorageDirectory#lock()