simonbence commented on a change in pull request #5059:
URL: https://github.com/apache/nifi/pull/5059#discussion_r632531276



##########
File path: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-nar-loading-utils/src/main/java/org/apache/nifi/nar/NarProviderTask.java
##########
@@ -0,0 +1,97 @@
+/*
+ * 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.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.StandardCopyOption;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Set;
+import java.util.UUID;
+import java.util.stream.Collectors;
+
+final class NarProviderTask implements Runnable {
+    private static final Logger LOGGER = 
LoggerFactory.getLogger(NarProviderTask.class);
+    private static final String NAR_EXTENSION = "nar";
+
+    // A unique id is necessary for temporary files not to collide with 
temporary files from other instances.
+    private final String id = UUID.randomUUID().toString();
+
+    private final NarProvider narProvider;
+    private final long pollTimeInMs;
+    private final File extensionDirectory;
+
+    private volatile boolean stopped = false;
+
+    NarProviderTask(final NarProvider narProvider, final File 
extensionDirectory, final long pollTimeInMs) {
+        this.narProvider = narProvider;
+        this.pollTimeInMs = pollTimeInMs;
+        this.extensionDirectory = extensionDirectory;
+    }
+
+    @Override
+    public void run() {
+        LOGGER.info("Nar provider task is started");
+
+        while (!stopped) {
+            try {
+                LOGGER.debug("Task starts fetching NARs from provider");
+                final Set<String> loadedNars = getLoadedNars();
+                final Collection<String> availableNars = 
narProvider.listNars();

Review comment:
       This one actually breaks the behaviour. I am not sure why at this point, 
but it behaves the same way as if the context classloader would not be set.




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


Reply via email to