public MetricsScope getStoredScope(String name) throws IllegalStateException {
    if (threadLocalScopes.get().containsKey(name)) {
      return threadLocalScopes.get().get(name);
    } else {
      throw new IllegalStateException("No metrics scope named " + name);
    }
  }
Closes scope if open, and reopens it
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/common/metrics/LegacyMetrics.java