private Supplier getSupplier()

in src/main/java/org/apache/sling/commons/metrics/internal/JmxExporterFactory.java [149:161]


    private <T> Supplier<T> getSupplier ( ObjectName name, String attributeName, T defaultValue ) {
        
        return () -> {
            try {
                return (T) server.getAttribute(name, attributeName);
            } catch (InstanceNotFoundException | AttributeNotFoundException | ReflectionException
                    | MBeanException e) {
                LOG.warn("error when retrieving value for MBean (objectname=[{}], attribute={})",name, attributeName,e);
                return defaultValue;
            }
            
        };
    }