ProcessFileLock { public static ProcessFileLock create(String filename) { try { Path abspath = Paths.get(filename).toRealPath(); return locks.computeIfAbsent(abspath, ProcessFileLock::new); } catch (IOException e) { IO.exception(e); return null; } } private  ProcessFileLock(Path filename); static ProcessFileLock create(String filename); static void release(ProcessFileLock lockFile); void lockEx(); void lockWait(); boolean tryLock(); void unlock(); boolean isLockedHere(); Path getPath();  }
@Test public void process_lock_2() { ProcessFileLock lock1 = ProcessFileLock.create(lockfile); ProcessFileLock lock2 = ProcessFileLock.create(lockfile); assertSame(lock1, lock2); }