Producer Consumer Problem in Java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Producer Consumer Problem in Java

I know three methods of solving: 1. By using Blocking queue 2. By using synchronized and wait,notify. 3 And other By using Semaphore . My question is which is the best approach of solving the problem.

20th Feb 2019, 3:45 AM
Mohd Zaki
Mohd Zaki - avatar
1 Answer
+ 1
This surely depends on your problem and its specific requirements (for example speed, number of threads, ...). I just want to throw in another solution, namely the reactive model of RxJava. It's a really cool framework for solving those problems on an other level of abstraction.
21st Feb 2019, 12:30 AM
merkrafter