void sourceStateUpdated(String sourceName) {
      List<EntityInfo> interestedEntityInfos = null;
      lock.lock();
      try {
        Collection<EntityInfo> entities = sourceToEntity.get(sourceName);
        if (entities != null) {
          // Create a copy since the underlying list can be changed elsewhere.
          interestedEntityInfos = new LinkedList<>(entities);
        }
      } finally {
        lock.unlock();
      }
      if (interestedEntityInfos != null) {
        for (EntityInfo entityInfo : interestedEntityInfos) {
          boolean newFinishState = QueryFragmentInfo.canFinish(entityInfo.getFragmentInfo());
          if (newFinishState != entityInfo.getLastFinishableState()) {
            // State changed. Callback
            entityInfo.setLastFinishableState(newFinishState);
            entityInfo.getHandler().finishableStateUpdated(newFinishState);
          }
        }
      }
    }
@param handler
@param sources
@param fragmentInfo
@param lastFinishableState
@return true if the current state is the same as the lastFinishableState. false if the state has already changed.
llap-server/src/java/org/apache/hadoop/hive/llap/daemon/impl/QueryInfo.java