Skip to content

Instantly share code, notes, and snippets.

@kballenegger
Created August 8, 2012 22:18
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 kballenegger/26b6bddf451b5b1fc7dc to your computer and use it in GitHub Desktop.
Save kballenegger/26b6bddf451b5b1fc7dc to your computer and use it in GitHub Desktop.
(defn make-persistent-queue
"returns a higher-order function which executes its argument in a serial background thread, queuing up messages asynchronously"
[]
(let [executor (Executors/newSingleThreadExecutor)]
(.run executor)
(fn [f] (.execute executor f))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment