code: public final static boolean isLocked(final String path) {
  
          boolean locked = true;
  
          try {
              LockFile lockFile = LockFile.newLockFile(path);
  
              lockFile.checkHeartbeat(false);
  
              locked = false;
          } catch (Exception e) {}
  
          return locked;
      }
docs: Retrieves whether there is potentially already a cooperative lock,
  operating system lock or some other situation preventing a cooperative
  lock condition from being aquired using the specified path.
  
  @param path the path to test
  @return <tt>true</tt> if there is currently something preventing the
  acquisition of a cooperative lock condition using the specified
  <tt>path</tt>, else <tt>false</tt>