@Override
    public boolean equals(Object o) {
      if (this == o) {
        return true;
      }
      if (o == null || getClass() != o.getClass()) {
        return false;
      }

      ModulesPathsKey that = (ModulesPathsKey) o;

      if (stackRoot != null ? !stackRoot.equals(that.stackRoot) : that.stackRoot != null) {
        return false;
      }
      if (commonServicesRoot != null ? !commonServicesRoot.equals(that.commonServicesRoot) : that.commonServicesRoot != null) {
        return false;
      }
      return !(extensionRoot != null ? !extensionRoot.equals(that.extensionRoot) : that.extensionRoot != null);

    }
Directory tree rescans and stack modules parsing take much time on every module init.
This class enhances {@code}StackManager{@code} to reuse already parsed modules.
ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerMock.java