Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Chouser
Created October 29, 2010 18:22
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 Chouser/654062 to your computer and use it in GitHub Desktop.
Save Chouser/654062 to your computer and use it in GitHub Desktop.
LinkedBlockingQueue
(import '(java.util.concurrent LinkedBlockingQueue TimeUnit))
(def q (LinkedBlockingQueue. 5))
(future (while true
(println (str "took " (.take q)))
(Thread/sleep 500))) ; simulate slow IO
(doseq [x (range 10)]
(println (str "offering " x))
(.offer q x 100 TimeUnit/SECONDS))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment