0

Java's ArrayBlockingQueue's take() method blocks, and sits and waits until something is put into the queue.

Another method would be to have the thread call poll() in a loop until it doesn't return null.

Why does the take() method not cause a CPU spike to happen but the poll() method does? I understand why the poll version spikes the CPU, but what is happening under the hood with the take() method that doesn't cause the CPU to spike?

Matthew
  • 3,886
  • 7
  • 47
  • 84

0 Answers0