TRS.RUN
Methods implementing 'Runnable.run()' should be "synchronized"
Description
This rule flags any method that implements `Runnable.run()' and that is not "synchronized".
The method 'run()' of a class that implements the Runnable interface should be synchronized. Multiple threads can be started for the same object implementing the Runnable "interface"; the method 'run()' can be executed concurrently.
Example
package TRS;
public class RUN implements Runnable {
public void run () { // violation, this method should be syn-
chronized.
}
}
Repair
Declare 'Runnable.run()' method "synchronized".
Reference
http://www.ispras.ru/~knizhnik/jlint/ReadMe.htm
|