class_docstr: Lock class for synchronizing processes for NFSv3 or later.
  
  On acquiring the lock, open system call is called with the O_EXCL option to create an exclusive
  file. The file is deleted when the lock is released. This class is only supported when using
  NFSv3 or later on kernel 2.6 or later. In prior NFS environments, use
  :class:`~optuna.storages.JournalFileSymlinkLock`.
  
  Args:
      filepath:
          The path of the file whose race condition must be protected.
class_docstr_tok: ["Lock","class","for","synchronizing","processes","for","NFSv3","or","later",".","On","acquiring","the","lock",",","open","system","call","is","called","with","the","O_EXCL","option","to","create","an","exclusive","file",".","The","file","is","deleted","when","the","lock","is","released",".","This","class","is","only","supported","when","using","NFSv3","or","later","on","kernel","2.6","or","later",".","In","prior","NFS","environments",",","use",":","class",":","`","~optuna.storages.JournalFileSymlinkLock","`",".","Args",":","filepath",":","The","path","of","the","file","whose","race","condition","must","be","protected","."]
docstr: Acquire a lock in a blocking way by creating a lock file.
  
  Returns:
      :obj:`True` if it succeeded in creating a `self._lock_file`
docstr_tok: ["Acquire","a","lock","in","a","blocking","way","by","creating","a","lock","file",".","Returns",":",":","obj",":","`","True","`","if","it","succeeded","in","creating","a","`","self._lock_file","`"]
code: def acquire(self) -> bool:
      """Acquire a lock in a blocking way by creating a lock file.
  
      Returns:
          :obj:`True` if it succeeded in creating a `self._lock_file`
  
      """
      sleep_secs = 0.001
      while True:
          try:
              open_flags = os.O_CREAT | os.O_EXCL | os.O_WRONLY
              os.close(os.open(self._lock_file, open_flags))
              return True
          except OSError as err:
              if err.errno == errno.EEXIST:
                  time.sleep(sleep_secs)
                  sleep_secs = min(sleep_secs * 2, 1)
                  continue
              raise err
          except BaseException:
              self.release()
              raise
  
imports: import abc
  from contextlib import contextmanager
  import errno
  import json
  import os
  import time
  from typing import Any
  from typing import Dict
  from typing import Iterator
  from typing import List
  from typing import Optional
  import uuid
  from optuna.storages._journal.base import BaseJournalLogStorage
label_desc: Use image node_id 2 for calling the JournalFileOpenLock obj's underlying member method code with example usage: obj.acquire() and returns: True