Skip to content

Instantly share code, notes, and snippets.

@yayitswei
Created April 12, 2012 09:37
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 yayitswei/2365902 to your computer and use it in GitHub Desktop.
Save yayitswei/2365902 to your computer and use it in GitHub Desktop.
what's the difference between the two?
;; this one fails with
;;#<IllegalStateException java.lang.IllegalStateException: Invalid use of SingleClientConnManager: connection still allocated.
;;Make sure to release the connection before allocating another one.>
(defn run-test [num-requests channel-name]
(let [channel (ChannelAPI.)
requests (init-requests num-requests channel-name)
listener (make-listener requests)]
(connect-at-sim channel channel-name listener)
(doall (map do-request requests))))
;; this one works the way I want but uses defs
(defn run-test2 [num-requests channel-name]
(def channel (ChannelAPI.))
(def requests (init-requests num-requests channel-name))
(def listener (make-listener requests))
(connect channel channel-name listener)
(doall (map do-request requests)))
@yayitswei
Copy link
Author

turns out connect-at-sim had a reference to "channel" which only worked when channel was reset in run-test2. I've corrected the typo. thanks for the help everyone :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment