apucher commented on a change in pull request #6613:
URL: https://github.com/apache/incubator-pinot/pull/6613#discussion_r593503414



##########
File path: 
pinot-common/src/main/java/org/apache/pinot/common/utils/fetcher/SegmentFetcherFactory.java
##########
@@ -34,29 +34,40 @@
 
 
 public class SegmentFetcherFactory {
-  private SegmentFetcherFactory() {
-  }
+  private final static SegmentFetcherFactory instance = new 
SegmentFetcherFactory();
 
   static final String SEGMENT_FETCHER_CLASS_KEY_SUFFIX = ".class";
   private static final String PROTOCOLS_KEY = "protocols";
+  private static final String AUTH_TOKEN_KEY = "auth.token";
   private static final String ENCODED_SUFFIX = ".enc";
 
   private static final Logger LOGGER = 
LoggerFactory.getLogger(SegmentFetcherFactory.class);
-  private static final Map<String, SegmentFetcher> SEGMENT_FETCHER_MAP = new 
HashMap<>();
-  private static final SegmentFetcher DEFAULT_HTTP_SEGMENT_FETCHER = new 
HttpSegmentFetcher();
-  private static final SegmentFetcher DEFAULT_PINOT_FS_SEGMENT_FETCHER = new 
PinotFSSegmentFetcher();
-
-  static {
-    PinotConfiguration emptyConfig = new PinotConfiguration();
-    DEFAULT_HTTP_SEGMENT_FETCHER.init(emptyConfig);
-    DEFAULT_PINOT_FS_SEGMENT_FETCHER.init(emptyConfig);
+
+  private final Map<String, SegmentFetcher> _segmentFetcherMap = new 
HashMap<>();
+  private final SegmentFetcher _httpSegmentFetcher = new HttpSegmentFetcher();
+  private final SegmentFetcher _pinotFSSegmentFetcher = new 
PinotFSSegmentFetcher();
+
+  private SegmentFetcherFactory() {
+    // left blank
+  }
+
+  public static SegmentFetcherFactory getInstance() {
+    return instance;
   }
 
   /**
    * Initializes the segment fetcher factory. This method should only be 
called once.
    */
   public static void init(PinotConfiguration config)
       throws Exception {
+    getInstance().initInternal(config);
+  }
+
+  private void initInternal(PinotConfiguration config)
+      throws Exception {
+    _httpSegmentFetcher.init(config); // directly, without sub-namespace

Review comment:
       these replace the static fetcher instances from the comment above




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to