From issues-return-88384-archive-asf-public=cust-asf.ponee.io@nifi.apache.org Thu Nov 21 20:53:20 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id E863B180665 for ; Thu, 21 Nov 2019 21:53:19 +0100 (CET) Received: (qmail 48677 invoked by uid 500); 21 Nov 2019 20:53:18 -0000 Mailing-List: contact issues-help@nifi.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@nifi.apache.org Delivered-To: mailing list issues@nifi.apache.org Received: (qmail 48497 invoked by uid 99); 21 Nov 2019 20:53:18 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Nov 2019 20:53:18 +0000 From: GitBox To: issues@nifi.apache.org Subject: [GitHub] [nifi] markap14 commented on a change in pull request #3894: NIFI-6884 - Native library loading fixed/improved Message-ID: <157436959812.23795.2889658317253577241.gitbox@gitbox.apache.org> Date: Thu, 21 Nov 2019 20:53:18 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit markap14 commented on a change in pull request #3894: NIFI-6884 - Native library loading fixed/improved URL: https://github.com/apache/nifi/pull/3894#discussion_r349307923 ########## 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 { + Logger LOGGER = LoggerFactory.getLogger(NativeLibFinder.class); + + String OS = System.getProperty("os.name").toLowerCase(); + + List getNativeLibDirs(); + + Map getNativeLibNameToPath(); + + String getTmpLibFilePrefix(); + + default Set getUsrLibDirs() { Review comment: Rather than having a default function for this that is evaluated each time it's needed, these values, I don't believe, will change over the lifetime of the JVM. Would recommend instead making it into a `private static final Set` and computing only once. ---------------------------------------------------------------- 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: users@infra.apache.org With regards, Apache Git Services