rpuch commented on a change in pull request #460:
URL: https://github.com/apache/ignite-3/pull/460#discussion_r760088592



##########
File path: 
modules/runner/src/main/java/org/apache/ignite/internal/configuration/ServiceLoaderModulesProvider.java
##########
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.configuration;
+
+import static java.util.stream.Collectors.toUnmodifiableList;
+
+import java.util.List;
+import java.util.ServiceLoader;
+import java.util.ServiceLoader.Provider;
+
+/**
+ * Provides {@link ConfigurationModule}s using {@link ServiceLoader} mechanism.
+ * Uses {@link ConfigurationModule} interface to query the ServiceLoader.
+ *
+ * @see ConfigurationModule
+ */
+public class ServiceLoaderModulesProvider {

Review comment:
       Having `CompoundModule` and `ConfigurationModules` separate from each 
other is just to follow SRP. Each of them has distinct responsibilities: 
`CompoundModule~ is for merging a few modules together, and 
`ConfigurationModules` is to make local/distributed modules separation more 
readable. In the code you suggested all 3 responsabilities (load modules from 
somewhere, in this case using `ServiceLoader`; merge them; and separate them) 
are intermingled in the same class. This would make testing harder (this is 
what happened with Ignite 2).
   
   Also, the change you suggest would make it problematic to use this class for 
loading other extensions (which you suggest further).
   
   So I would prefer to leave it as is; maybe just decrease visibility of 
`CompoundModule` to package local (so that it does not confuse anyone)?
   
   As for giving the `ServiceLoaderModulesProvider` an ability to load any 
extension instead of just configuration modules (and renaming it): are you sure 
we need to do it right now? How about waiting for the moment when this future 
actually comes, and then doing this (or something different that would seem 
correct when we reach that future)? As this might end up with a code that is 
never used. When this future comes, it will be easy to rename the class and 
change it slightly.
   
   What do you think?




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to