jill/src/main/java/io/github/agentsoz/jill/core/IntentionSelector.java
private void waitOnExternalMessage() {
    synchronized (lock) {
      while (!hasMessage) {
        try {
          logger.debug("Pool {} is idle; will wait on external message", poolid);
          // Main.incrementPoolsIdle();
          isIdle = true;
          Main.flagPoolIdle();
          lock.wait();
          isIdle = false;
          // Main.decrementPoolsIdle();
          logger.debug("Pool {} just woke up on external message", poolid);
        } catch (InterruptedException e) {
          logger.error("Pool " + poolid + " failed to wait on external message: ", e);
        }
      }
      hasMessage = false;
    }
  }
private void waitOnExternalMessage() {
    synchronized (lock) {
      while (!hasMessage) {
        try {
          logger.debug("Pool {} is idle; will wait on external message", poolid);
          // Main.incrementPoolsIdle();
          isIdle = true;
          Main.flagPoolIdle();
          lock.wait();
          isIdle = false;
          // Main.decrementPoolsIdle();
          logger.debug("Pool {} just woke up on external message", poolid);
        } catch (InterruptedException e) {
          logger.error("Pool " + poolid + " failed to wait on external message: ", e);
        }
      }
      hasMessage = false;
    }
  }
Waits on {@link IntentionSelector#lock} until woken up by an external message.