multithreading - Java thread wait and notify -


I have two threads. Thread A is pulling some element from the queue and thread B is adding some element to the queue.

When thread B connects some elements to the queue, then I should ensure that thread A is working. How can this be done in Java? Use

which is:

A line Also supports additional operations that wait for the queue to not be empty when retrieving an element, and wait for the space to be available in the queue while archiving an element

Seriously, do not try to change the wheel again here.

(If you wait / inform, read. But give yourself pain, please!)


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -