rspec/rules/S2690/rule.adoc
2022-02-04 16:28:24 +00:00

19 lines
503 B
Plaintext

The point of calling ``++notify++``, or more prefereably ``++notifyAll++``, is to alert other threads that the state of ``++this++`` object has changed. Doing so without a state change seems pointless, and may indicate a logic error.
== Noncompliant Code Example
[source,text]
----
public void run(){
synchronized(this){
int total = 0;
for(int i=0; i<100 ; i++){
total += i;
}
notify(); // Noncompliant; only local variables have been modified. What's the point?
}
}
----