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

com.aol.micro.server.application.registry.RegistryStatsChecker Maven / Gradle / Ivy

There is a newer version: 0.91.11
Show newest version
package com.aol.micro.server.application.registry;

import java.util.List;
import java.util.Map;
import java.util.Objects;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import com.aol.cyclops.data.collections.extensions.standard.ListX;
import com.aol.micro.server.StatsSupplier;

@Component
public class RegistryStatsChecker {

    private final ListX status;
    private final boolean active;

    public RegistryStatsChecker() {
        status = ListX.empty();
        this.active = false;
    }

    @Autowired(required = false)
    public RegistryStatsChecker(final List status,
            @Value("${service.registry.stats.active:true}") boolean active) {
        this.status = ListX.fromIterable(status);
        this.active = active;
    }

    public List>> stats() {
        if (!active)
            return null;
        return status.map(StatsSupplier::get)
                     .filter(Objects::nonNull);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy