su.nlq.prometheus.jmx.connection.Connection Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jmx-prometheus-collector Show documentation
Show all versions of jmx-prometheus-collector Show documentation
Pipe for JMX MBeans to Prometheus
package su.nlq.prometheus.jmx.connection;
import org.jetbrains.annotations.NotNull;
import su.nlq.prometheus.jmx.logging.Logger;
import java.io.IOException;
import java.util.Optional;
public abstract class Connection {
private final @NotNull Optional name;
protected Connection(@NotNull Optional name) {
this.name = name;
}
public abstract void accept(@NotNull ConnectionConsumer consumer);
protected final @NotNull String name(@NotNull String other) {
return name.orElse(other);
}
protected static void fail(@NotNull String name, @NotNull IOException e) {
Logger.instance.error("Failed connect to " + name + ": " + e.getMessage());
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy