public void obtain() throws IOException {
  if (fileLock != null && fileLock.isValid()) {
    return;
  }
  fileLock=fileToLock.lock();
}

public void obtain ( ) throws IOException { if ( fileLock != null && fileLock . isValid ( ) ) { return ; } fileLock = fileToLock . lock ( ) ; }
locks the file ( blocking ) .
