public boolean acquireLock(String lockName,long waitInSeconds){
  if (lockName == null || lockName.isEmpty()) {
    s_logger.info("No lock name specified.");
    return false;
  }
  try {
    InterProcessLock lock=_coordinator.getLock(lockName);
    if (lock != null) {
      if (waitInSeconds >= 0) {
        s_logger.info("Attempting to acquire lock: " + lockName + " for a maximum of "+ waitInSeconds+ " seconds.");
        if (!lock.acquire(waitInSeconds,TimeUnit.SECONDS)) {
          s_logger.info("Failed to acquire lock: " + lockName);
          return false;
        }
      }
 else {
        s_logger.info("Attempting to acquire lock: " + lockName + " for as long as it takes.");
        lock.acquire();
      }
      s_acquiredLocks.put(lockName,lock);
    }
 else {
      return false;
    }
    s_logger.info("Acquired lock: " + lockName);
    return true;
  }
 catch (  Exception e) {
    s_logger.error("Acquisition of lock: {} failed with Exception: ",lockName,e);
    return false;
  }
}

public boolean acquireLock ( String lockName , long waitInSeconds ) { if ( lockName == null || lockName . isEmpty ( ) ) { s_logger . info ( "No lock name specified." ) ; return false ; } try { InterProcessLock lock = _coordinator . getLock ( lockName ) ; if ( lock != null ) { if ( waitInSeconds >= 0 ) { s_logger . info ( "Attempting to acquire lock: " + lockName + " for a maximum of " + waitInSeconds + " seconds." ) ; if ( ! lock . acquire ( waitInSeconds , TimeUnit . SECONDS ) ) { s_logger . info ( "Failed to acquire lock: " + lockName ) ; return false ; } } else { s_logger . info ( "Attempting to acquire lock: " + lockName + " for as long as it takes." ) ; lock . acquire ( ) ; } s_acquiredLocks . put ( lockName , lock ) ; } else { return false ; } s_logger . info ( "Acquired lock: " + lockName ) ; return true ; } catch ( Exception e ) { s_logger . error ( "Acquisition of lock: {} failed with Exception: " , lockName , e ) ; return false ; } }
attempts to acquire the passed lock .
