What is the situation of java thread execution?
This article mainly explains "what are the circumstances of java thread execution". The explanation in this article is simple and clear, easy to learn and understand. Please follow the ideas of Xiaobian and go deep into it slowly to study and learn "what are the circumstances of java thread execution" together!
If the queue is full, the new thread performing the put operation will be added to the notFull conditional queue waiting.
2. The queue is not full. When a thread performs the operation of removing queue elements, the removal succeeds and the put thread is awakened.
examples
public E take() throws InterruptedException { final ReentrantLock lock = this.lock; lock.lockInterruptibly(); try { //queue length is 0 while (count == 0) //blocking notEmpty.await(); //delete if queue has elements return dequeue(); } finally { lock.unlock(); } }/** Condition for waiting takes */ private final Condition notEmpty; Thank you for reading, the above is "java thread execution what" content, after the study of this article, I believe that we have a deeper understanding of java thread execution what this problem, the specific use of the situation also needs to be verified. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!