Github user markap14 commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/3119#discussion_r230120699
  
    --- Diff: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-nar-loading-utils/src/main/java/org/apache/nifi/nar/NarAutoLoader.java
 ---
    @@ -0,0 +1,89 @@
    +/*
    + * 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.apache.nifi.util.FileUtils;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +
    +import java.io.File;
    +import java.io.IOException;
    +import java.nio.file.FileSystems;
    +import java.nio.file.Path;
    +import java.nio.file.StandardWatchEventKinds;
    +import java.nio.file.WatchService;
    +import java.util.Objects;
    +
    +/**
    + * Starts a thread to monitor the auto-load directory for new NARs.
    + */
    +public class NarAutoLoader {
    +
    +    private static final Logger LOGGER = 
LoggerFactory.getLogger(NarAutoLoader.class);
    +
    +    private static final long POLL_INTERVAL_MS = 5000;
    +
    +    private final File autoLoadDir;
    +    private final NarLoader narLoader;
    +
    +    private volatile NarAutoLoaderTask narAutoLoaderTask;
    +    private volatile boolean started = false;
    +
    +    public NarAutoLoader(final File autoLoadDir, final NarLoader 
narLoader) {
    +        this.autoLoadDir = autoLoadDir;
    --- End diff --
    
    This should probably just be written as `this.autoLoadDir = 
Objects.requireNonNull(autoLoadDir);` and `this.narLoader = 
Objects.requireNonNull(narLoader);`


---

Reply via email to