<commit_before>(ns riemann.bin
  "Main function."
  (:require riemann.config
            riemann.logging
            riemann.time
            riemann.pubsub)
  (:use clojure.tools.logging)
  (:gen-class))

(def config-file
  "The configuration file loaded by the bin tool" 
  (atom nil))

(def reload-lock (Object.))

(defn reload!
  "Reloads the given configuration file by clearing the task scheduler, shutting
  down the current core, and loading a new one."
  []
  (locking reload-lock
    (try
      (riemann.config/validate-config @config-file)
      (riemann.time/reset-tasks!)
      (riemann.config/clear!)
      (riemann.pubsub/sweep! (:pubsub @riemann.config/core))
      (riemann.config/include @config-file)
      (riemann.config/apply!)
      :reloaded
      (catch Exception e
        (error e "Couldn't reload:")
        e))))

(defn handle-signals
  "Sets up POSIX signal handlers."
  []
  (sun.misc.Signal/handle
    (sun.misc.Signal. "HUP")
    (proxy [sun.misc.SignalHandler] []
      (handle [sig]
              (info "Caught SIGHUP, reloading")
              (reload!)))))
(defn pid
  "Process identifier, such as it is on the JVM. :-/"
  []
  (let [name (-> (java.lang.management.ManagementFactory/getRuntimeMXBean)<commit_msg>Don't register HUP signal handler on Windows<commit_after>(ns riemann.bin
  "Main function."
  (:require riemann.config
            riemann.logging
            riemann.time
            riemann.pubsub)
  (:use clojure.tools.logging)
  (:gen-class))

(def config-file
  "The configuration file loaded by the bin tool" 
  (atom nil))

(def reload-lock (Object.))

(defn reload!
  "Reloads the given configuration file by clearing the task scheduler, shutting
  down the current core, and loading a new one."
  []
  (locking reload-lock
    (try
      (riemann.config/validate-config @config-file)
      (riemann.time/reset-tasks!)
      (riemann.config/clear!)
      (riemann.pubsub/sweep! (:pubsub @riemann.config/core))
      (riemann.config/include @config-file)
      (riemann.config/apply!)
      :reloaded
      (catch Exception e
        (error e "Couldn't reload:")
        e))))

(defn handle-signals
  "Sets up POSIX signal handlers."
  []
  (if (not (. contains (. System getProperty "os.name") "Windows"))
    (sun.misc.Signal/handle
      (sun.misc.Signal. "HUP")
      (proxy [sun.misc.SignalHandler] []
        (handle [sig]
                (info "Caught SIGHUP, reloading")
                (reload!))))))
(defn pid
  "Process identifier, such as it is on the JVM. :-/"
  []
  (let [name (-> (java.lang.management.ManagementFactory/getRuntimeMXBean)
{'fraction_non_alphanumeric': 0.1310344827586207, 'fraction_numerical': 0.0, 'mean_word_length': 2.6415620641562065, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1160251', 'n_tokens_mistral': 896, 'n_tokens_neox': 825, 'n_words': 220}