boolean isManaged(MappingInput input) {
    // This is always replaced atomically, so we don't care about concurrency here.
    UserPoolMapping mapping = userPoolMapping;
    if (mapping != null) {
      // Don't pass in the pool set - not thread safe; if the user is trying to force us to
      // use a non-existent pool, we want to fail anyway. We will fail later during get.
      String mappedPool = mapping.mapSessionToPoolName(input, allowAnyPool, null);
      LOG.info("Mapping input: {} mapped to pool: {}", input, mappedPool);
      return true;
    }
    return false;
  }
Extracts the session and cancel the operation, both only if done.
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/WorkloadManager.java