== Why is this an issue?

In Java, the `Thread` class represents a thread of execution.
Synchronization between threads is typically achieved using objects or shared resources.

The methods `wait(...)`, `notify()`, and `notifyAll()` are related to the underlying object's monitor
and are designed to be called on objects that act as locks or monitors for synchronization.
These methods are available on Java `Object` and, therefore, automatically inherited by all objects, including `Thread.`

Calling these methods on a `Thread` may corrupt the behavior of the JVM, which relies on them to change the state
of the thread (`BLOCKED,` `WAITING,`...).


=== Noncompliant code example

[source,java]
----
Thread myThread = new Thread(new RunnableJob());
...
myThread.wait(); // Noncompliant
----

== Resources

* https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/lang/Thread.html[Oracle Java SE - Thread]
* https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/lang/Object.html[Oracle Java SE - Object]

ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

=== Message

Refactor the synchronisation mechanism to not use a Thread instance as a monitor.


endif::env-github,rspecator-view[]
