turcsanyip commented on a change in pull request #3894: NIFI-6884 - Native 
library loading fixed/improved
URL: https://github.com/apache/nifi/pull/3894#discussion_r349322277
 
 

 ##########
 File path: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-nar-utils/src/main/java/org/apache/nifi/nar/NativeLibFinder.java
 ##########
 @@ -0,0 +1,159 @@
+/*
+ * 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.nifi.nar;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
+
+public interface NativeLibFinder {
 
 Review comment:
   I was also thinking about the concept of this interface. In my opinion, the 
inheritance would be fine, but I would rather use an abstract class (between 
URLClassLoader and NarClassLoader/InstanceClassLoader) instead of a separate 
interface.
   
   This interface contains a lot of implementation (that should be private / 
protected instead of public). Furthermore, it does not add a new feature to 
NarClassLoader/InstanceClassLoader, actually just implements `findLibrary()` 
which also exists in URLClassLoader. That's why an abstract class seems more 
natural to me.
   
   This way the following method could be avoided too:
   ```
       public String findLibrary(String libname) {
           return NativeLibFinder.super.findLibrary(libname);
       }
   ```

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to