Skip to content

Instantly share code, notes, and snippets.

@sritchie
Created January 19, 2012 20:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sritchie/1642241 to your computer and use it in GitHub Desktop.
Save sritchie/1642241 to your computer and use it in GitHub Desktop.
(defprotocol Connected
(connected? [_])
(get-connection [_]))
(defn listener [afn space thing]
(let [conn-atom (atom nil)]
(proxy [elephantdb.common.kryo.Connected Listener] []
(connected? [_] (boolean @conn-atom))
(get-connection [_]
@conn-atom)
(connected [conn]
(reset! conn-atom conn)
(.addConnection space thing))
(received [conn obj]
(when-not (instance? FrameworkMessage obj)
(afn conn obj))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment