Fork me on GitHub
#off-topic
<
2017-03-13
>
yonatanel13:03:14

Any fun hackathons in europe?

istvan16:03:38

yonatanel some, not sure if anything specific to Clojure

istvan16:03:43

we had one recently here in Hungary with telco data (that we won 😛 )

yonatanel16:03:01

istvan What was the goal?

istvan16:03:59

make some sense of telco data including cellular info, call history and CRM

istvan18:03:20

gey guys, does anybody have a BlockingQueue in Java that mimics the behaviour a blocking consumer in a thread with a go-loop + recur?

istvan18:03:27

i would like to block the sender until the receiver takes the item from a queue and processes it (i guess with while (true) {} instead of go-loop)

tbaldridge18:03:43

I don't understand...blocking queue does that, doesn't it? I if you call put it blocks until there is room in the queue

istvan18:03:22

right, and this is the easy part

istvan18:03:34

i am more interested the poll/peek/consumer part

istvan18:03:28

(thread
  (go-loop []
    (let [  message (blocking-consumer work-chan)
      (process message)
      (recur))))

istvan19:03:30

I guess i will while (value = queue.take()) { doSomething(value); }

tbaldridge19:03:35

I'm not sure why you nested a go-loop inside a thread use one or the other, there's no reason to use both.

tbaldridge19:03:18

and if blocking-consumer is blocking, you shouldn't do that in a go-loop. So I'm really confused as to what you're trying to accomplish given what you're asking.

tbaldridge19:03:25

maybe I just need more information

istvan19:03:40

there used to be a bug with core.async but i already forgot what it was

istvan19:03:49

i can just use a go-loop + recur now

istvan19:03:01

i guess i am looking for a go-loop in Java 🙂

tbaldridge19:03:55

um...using a go-loop inside a thread has never been a good idea, nor a suggested approach

tbaldridge19:03:27

go-loop creates a callback that is run in another thread. thread creates a thread that runs the body. So it's redundant.