use BlockingQueue to implement producer-consumer pattern