<commit_before>(ns org.altlaw.util.restlet
  (:use org.altlaw.util.log)
  (:import (org.restlet Component)
           (org.restlet.data Protocol)))

(defn make-component [port app-instance]
  (let [com (Component.)]
    (.. com getServers (add Protocol/HTTP port))
    (.. com getClients (add Protocol/FILE))
    (let [child-context (.createChildContext (.getContext com))]
      (.setContext app-instance child-context))
    (.. com getDefaultHost (attach app-instance))
    com))

(defmacro with-server [port app-instance & body]
  `(let [server# (make-component ~port ~app-instance)]
     (.start server#)
     (try ~@body
          (finally (.stop server#)
                   (.. server# getServers clear)))))<commit_msg>util/restlet.clj: added delay after server shutdown<commit_after>(ns org.altlaw.util.restlet
  (:use org.altlaw.util.log)
  (:import (org.restlet Component)
           (org.restlet.data Protocol)))

(defn make-component [port app-instance]
  (let [com (Component.)]
    (.. com getServers (add Protocol/HTTP port))
    (.. com getClients (add Protocol/FILE))
    (let [child-context (.createChildContext (.getContext com))]
      (.setContext app-instance child-context))
    (.. com getDefaultHost (attach app-instance))
    com))

(defmacro with-server [port app-instance & body]
  `(let [server# (make-component ~port ~app-instance)]
     (.start server#)
     (try ~@body
          (finally (.stop server#)
                   (.. server# getServers clear)
                   (Thread/sleep 1000)))))
{'fraction_non_alphanumeric': 0.15062213490504256, 'fraction_numerical': 0.0026195153896529143, 'mean_word_length': 2.8585858585858586, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2113250', 'n_tokens_mistral': 493, 'n_tokens_neox': 470, 'n_words': 122}