code: private boolean processLockingMechanism() throws JournalException {
          boolean locked;
          if (lockRequestedFile.exists()) {
              try {
                  if (!lockAcceptedFile.exists()) {
                      lockAcceptedFile.createNewFile();
                  }
              } catch (IOException e) {
                  throw new JournalException("Unable to create 'Lock Accepted' file at '"
                          + lockAcceptedFile.getPath() + "'");
              }
              locked = true;
          } else {
              if (lockAcceptedFile.exists()) {
                  lockAcceptedFile.delete();
              }
              locked = false;
          }
  
          if (locked && !wasLocked) {
              recoveryLog.log("Lock request detected: "
                      + lockRequestedFile.getPath() + ", Lock accepted: "
                      + lockAcceptedFile.getPath());
          } else if (wasLocked && !locked) {
              recoveryLog.log("Lock request removed: "
                      + lockRequestedFile.getPath());
          }
  
          wasLocked = locked;
          return locked;
      }
docs: If we see a lock request, issue an acceptance. If we do not, withdraw the
  acceptance.
  
  @return true if locked, false if not locked.
  @throws JournalException
  if we fail to create the 'lock accepted' file.