code: private Lock createLock(boolean writer) {
          final int pid = getPID();
  
          final String baseLock;
          if (!writer) {
              baseLock = READER_LOCK_PREFIX + pid + LOCK_EXTENSION;
          } else {
              baseLock = WRITER_LOCK_PREFIX + pid + LOCK_EXTENSION;
          }
  
          int i = 0;
          while (locks.containsKey(baseLock + (++i))) {
              // no logic needed
          }
  
          final String lockName = baseLock + i;
          final Lock lock = new Lock(lockName);
  
          final File lockFile = new File(lockPath, lockName);
          try {
              if (!lockFile.createNewFile()) {
                  throw new IllegalStateException("could not create lock");
              }
          } catch (IOException e) {
              throw new IllegalStateException("could not create lock", e);
          }
  
          locks.put(lockName, lock);
          return lock;
      }
docs: Creates a {@link Lock lock} on the this instance of the
  {@link LockAdviser}. If <tt>writer</tt> is false then a {@link File read
  lock file} is created, otherwise a {@link File write lock file is
  created}.
  
  @param writer, <tt>true</tt> if a {@link File write lock file} should be
  created, <tt>false</tt> otherwise
  @return the created {@link Lock}
  @throws IllegalStateException Thrown if the {@link File lock file} could
  not be created