public AsyncFileLock(FileChannel file) throws IOException {
  Objects.requireNonNull(file);
  if (!file.isOpen()) {
    throw new IllegalArgumentException("param `file` is closed");
  }
  fileToLock=file;
  closeChannel=false;
}

public AsyncFileLock ( FileChannel file ) throws IOException { Objects . requireNonNull ( file ) ; if ( ! file . isOpen ( ) ) { throw new IllegalArgumentException ( "param `file` is closed" ) ; } fileToLock = file ; closeChannel = false ; }
creates a new asyncfilelock from the given filechannel . the channel must have been opened with the write option .
