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

41 lines
685 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
[source,java]
----
Thread t1 = new Thread(new Runnable() {
// ...
};
t1.start(); // Noncompliant; this thread wasn't named
----
== Compliant Solution
[source,java]
----
Thread t1 = new Thread(new Runnable() {
// ...
};
t1.setName("t1");
t1.start();
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]