both notify () and Notifyall () are methods that object objects are used to inform the thread that is waiting for the object.
void Notify (): Wakes up a thread that is waiting for the object.
void Notifyall (): Wakes all threads that are waiting on the object.
The biggest difference between the two is:
Notifyall causes all threads that originally wait on the object to be notify to exit the wait state, becoming a lock on the object, and once the object is unlocked, they compete.
Notify he just chooses a wait-state thread to notify, and it gets the lock on the object, but does not disturb other threads that are also waiting to be notify by the object, releasing the lock on the object when the first thread finishes running, and if the object does not use the Notify statement again, Even if the object is idle, the other waiting-state waits for the thread to remain in the wait state until it emits a notify or notifyall, and waits for a notify or notifyall instead of a lock, because the object is not notified.
The difference between Android notify () Notifyall ()