             ;; our selector, so we can finish up serving the requests we already
             ;; started but will not pick up any new connections
             (async/poll! finished-ch)
-            (let [key (first (filter #(= serversocket (.channel %))
-                                     (.keys selector)))]
+            (let [key ^SelectionKey
+                  (first (filter #(= serversocket (.channel %))
+                                 (.keys selector)))]
               ;; if the serversocket has been closed already (e.g. by another
               ;; thread when the listen-address is changed) then it will not
               ;; appear in this selector

(ns merlion.core
  (:import [java.nio Buffer ByteBuffer]
           [java.net InetSocketAddress]
           [java.nio.channels SocketChannel ServerSocketChannel
            Selector SelectionKey])
  (:gen-class)
  (:require [merlion.etcd :as etcd]

            {}
            (:backends config))))

(defn get-port [^ServerSocketChannel listener]
  (.. listener socket getLocalPort))

(defn update-listener [^ServerSocketChannel listener config]
  (when-let [l (get-in config [:config :log-level])]
    (when-not (= l (:level log/*config*))
      (log/info (str "Setting log level to " l))
