Fork me on GitHub

How do I know which JAVA methods are "blocking safe"? This takeFirst is non-blocking?


"Retrieves and removes the first element of this deque, waiting if necessary until an element becomes available." guess not


There is a ready impl of BlockingDeque piping into chan ?


in the case of BlockingDeque, there's actually a table that specifies which methods block at the top of the javadoc


if you wanted to bring a BlockingDeque and core.async together, I would expect lots of calls to async/thread


or at least one per Deque


I end up with

  (loop []
    (let [tx (.take tx-queue)]
      (async/put! conn-chan tx))


Use >!! Otherwise you are missing back pressure from the consumer of conn-chan


Using put! naively is very bad, using >!! often just does the right thing


conn-chan is a sliding buffer. It will just pub/sub it's value

conn-chan (async/chan (async/sliding-buffer 1))


you can also just use future instead of async/thread if you don't take from the returned chan

Ben Sless19:02:30

Hi all, I'm trying to create an async process which takes messages from an input channel, times them out, then passes them to output channel. Order is not important. As you can see, there's a bug in my implementation, both in that it doesn't create backpressure, and that it'll throw exceptions if n+1024 messages are consumed before being retired. Any recommendations on how to fix this, and without hitting the maximum put limit, such as with pipeline-async w/ n>1024?