rspec/rules/S3048/rule.adoc

24 lines
405 B
Plaintext

Naming a thread won't make it run faster or more reliably, but it will make it easier to deal with if you need to debug the application.
== Noncompliant Code Example
----
Thread t1 = new Thread(new Runnable() {
// ...
};
t1.start(); // Noncompliant; this thread wasn't named
----
== Compliant Solution
----
Thread t1 = new Thread(new Runnable() {
// ...
};
t1.setName("t1");
t1.start();
----