ロックを取得しようとしたが取得できなかったスレッドの状態
A thread goes to wait state once it calls wait() on an Object. This is called Waiting State. Once a thread reaches waiting state, it will need to wait till some other thread calls notify() or notifyAll() on the object.
Once this thread is notified, it will not be runnable. It might be that other threads are also notified (using notifyAll()) or the first thread has not finished his work, so it is still blocked till it gets its chance. This is called Blocked State. A Blocked state will occur whenever a thread tries to acquire lock on object and some other thread is already holding the lock.
Once other threads have left and its this thread chance, it moves to Runnable state after that it is eligible pick up work based on JVM threading mechanism and moves to run state.
スレッドを再開させるメソッド
notify()
このオブジェクトのモニターで待機中のスレッドを 1 つ再開します。
notifyAll()
このオブジェクトのモニターで待機中のすべてのスレッドを再開します。
ロックを保持ていないとオブジェクトを処理できない
ロックの概要
プロセス内の複数のスレッドが同じデータを共有して更新する場合は、エラーが発生しないようにそのアクティビティを同期化する必要があります。Java では、これを synchronized キーワード、または wait および notify を使用して行います。同期化はロックを使用して行われます。各ロックは JVM によってオブジェクトに関連付けられています。スレッドがオブジェクトを処理するには、そのオブジェクトに関連付けられているロックを制御する、つまり、ロックを「保持」する必要
があります。ロックを保持できるのは一度に 1 つのスレッドのみです。スレッドが別のスレッドに保持されているロックを取得しようとする場合は、そのロックが解放されるまで待機
する必要があります。このような状況の発生を、ロックの「競合」と呼びます。
感想
notify()を受けた待機状態のスレッドがロックを取得できなかった状態をブロック状態という