All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.newrelic.agent.service.module.URLAnalyzer Maven / Gradle / Ivy

The newest version!
/*
 *
 *  * Copyright 2020 New Relic Corporation. All rights reserved.
 *  * SPDX-License-Identifier: Apache-2.0
 *
 */
package com.newrelic.agent.service.module;

import com.newrelic.api.agent.Logger;

import java.net.URL;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.logging.Level;

public class URLAnalyzer implements Runnable {
    private final URL url;
    private final Function processor;
    private final Consumer analyzedJars;
    private final Logger logger;

    public URLAnalyzer(URL url, Function processor, Consumer analyzedJars, Logger logger) {
        this.url = url;
        this.processor = processor;
        this.analyzedJars = analyzedJars;
        this.logger = logger;
    }

    @Override
    public void run() {
        JarData jarData = processor.apply(url);
        if (jarData != null) {
            logger.log(Level.FINEST, "{0} adding analyzed jar: {1}", url, jarData);
            analyzedJars.accept(jarData);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy