 (ns thread-load.core
-  (:require [clojure.tools.logging :refer [error]])
+  (:require [clojure.tools.logging :refer [error debug info]])
   (:import
     [java.util ArrayList]
     [java.util.concurrent BlockingQueue ArrayBlockingQueue Executors ExecutorService TimeUnit ThreadPoolExecutor]

   by one of the consumer functions
   Returns the pool"
  [pool data]
   (.put ^BlockingQueue (:queue pool) data)
   pool)

(defn bulk-get!

(defn get-queue-data! 
  "Blocks till data is available on the queue and returns the data, queue must be BlockingQueue"
  [^BlockingQueue queue]
  (if-let [v (.poll queue 5 TimeUnit/SECONDS)]
    v
    (do
      (debug "No data from queue, blocking till data becomes available")
      (try
        (.take queue)
        (finally
          (debug "Unblocked"))))))

(defn call-on-fail 
  "Only calls init if the return of stop is not :terminate or :fail"
