public synchronized long getElapsedTime() {
    if (isRunning()) {
      return System.currentTimeMillis() - beginTime;
    } else {
      return endTime - beginTime;
    }
  }
The class is synchronized, as WebUI may access information about a running query.
ql/src/java/org/apache/hadoop/hive/ql/QueryInfo.java