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

io.prometheus.cloudwatch.ReloadSignalHandler Maven / Gradle / Ivy

package io.prometheus.cloudwatch;

import java.util.logging.Level;
import java.util.logging.Logger;
import sun.misc.Signal;
import sun.misc.SignalHandler;

class ReloadSignalHandler {
  private static final Logger LOGGER = Logger.getLogger(CloudWatchCollector.class.getName());

  protected static void start(final CloudWatchCollector collector) {
    Signal.handle(
        new Signal("HUP"),
        new SignalHandler() {
          public void handle(Signal signal) {
            try {
              collector.reloadConfig();
            } catch (Exception e) {
              LOGGER.log(Level.WARNING, "Configuration reload failed", e);
            }
          }
        });
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy