Update documentation

TRAVIS_JOB_NUMBER=3294.1
TRAVIS_COMMIT_RANGE=0424a45a4b03...f21851808992
This commit is contained in:
Travis CI (pmd-bot)
2019-01-13 03:58:15 +00:00
parent f218518089
commit 3db4763857
2 changed files with 39 additions and 2 deletions

View File

@ -297,7 +297,8 @@ folder: pmd/rules
* [DontCallThreadRun](pmd_rules_java_multithreading.html#dontcallthreadrun): Explicitly calling Thread.run() method will execute in the caller's thread of control. Instead, ...
* [DoubleCheckedLocking](pmd_rules_java_multithreading.html#doublecheckedlocking): Partially created objects can be returned by the Double Checked Locking pattern when used in Java...
* [NonThreadSafeSingleton](pmd_rules_java_multithreading.html#nonthreadsafesingleton): Non-thread safe singletons can result in bad state changes. Eliminatestatic singletons if possibl...
* [UnsynchronizedStaticDateFormatter](pmd_rules_java_multithreading.html#unsynchronizedstaticdateformatter): SimpleDateFormat instances are not synchronized. Sun recommends using separate format instancesfo...
* [UnsynchronizedStaticDateFormatter](pmd_rules_java_multithreading.html#unsynchronizedstaticdateformatter): <span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f; font-size: 75%;">Deprecated</span> SimpleDateFormat instances are not synchronized. Sun recommends using separate format instancesfo...
* [UnsynchronizedStaticFormatter](pmd_rules_java_multithreading.html#unsynchronizedstaticformatter): Instances of 'java.text.Format' are generally not synchronized.Sun recommends using separate form...
* [UseConcurrentHashMap](pmd_rules_java_multithreading.html#useconcurrenthashmap): Since Java5 brought a new implementation of the Map designed for multi-threaded access, you canpe...
* [UseNotifyAllInsteadOfNotify](pmd_rules_java_multithreading.html#usenotifyallinsteadofnotify): Thread.notify() awakens a thread monitoring the object. If more than one thread is monitoring, th...

View File

@ -5,7 +5,7 @@ permalink: pmd_rules_java_multithreading.html
folder: pmd/rules/java
sidebaractiveurl: /pmd_rules_java.html
editmepath: ../pmd-java/src/main/resources/category/java/multithreading.xml
keywords: Multithreading, AvoidSynchronizedAtMethodLevel, AvoidThreadGroup, AvoidUsingVolatile, DoNotUseThreads, DontCallThreadRun, DoubleCheckedLocking, NonThreadSafeSingleton, UnsynchronizedStaticDateFormatter, UseConcurrentHashMap, UseNotifyAllInsteadOfNotify
keywords: Multithreading, AvoidSynchronizedAtMethodLevel, AvoidThreadGroup, AvoidUsingVolatile, DoNotUseThreads, DontCallThreadRun, DoubleCheckedLocking, NonThreadSafeSingleton, UnsynchronizedStaticDateFormatter, UnsynchronizedStaticFormatter, UseConcurrentHashMap, UseNotifyAllInsteadOfNotify
language: Java
---
<!-- DO NOT EDIT THIS FILE. This file is generated from file ../pmd-java/src/main/resources/category/java/multithreading.xml. -->
@ -275,6 +275,8 @@ public static Foo getFoo() {
## UnsynchronizedStaticDateFormatter
<span style="border-radius: 0.25em; color: #fff; padding: 0.2em 0.6em 0.3em; display: inline; background-color: #d9534f;">Deprecated</span>
**Since:** PMD 3.6
**Priority:** Medium (3)
@ -283,6 +285,8 @@ SimpleDateFormat instances are not synchronized. Sun recommends using separate f
for each thread. If multiple threads must access a static formatter, the formatter must be
synchronized either on method or block level.
This rule has been deprecated in favor of the rule {% rule UnsynchronizedStaticFormatter %}.
**This rule is defined by the following Java class:** [net.sourceforge.pmd.lang.java.rule.multithreading.UnsynchronizedStaticDateFormatterRule](https://github.com/pmd/pmd/blob/master/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/multithreading/UnsynchronizedStaticDateFormatterRule.java)
**Example(s):**
@ -304,6 +308,38 @@ public class Foo {
<rule ref="category/java/multithreading.xml/UnsynchronizedStaticDateFormatter" />
```
## UnsynchronizedStaticFormatter
**Since:** PMD 6.11.0
**Priority:** Medium (3)
Instances of `java.text.Format` are generally not synchronized.
Sun recommends using separate format instances for each thread.
If multiple threads must access a static formatter, the formatter must be
synchronized either on method or block level.
**This rule is defined by the following Java class:** [net.sourceforge.pmd.lang.java.rule.multithreading.UnsynchronizedStaticFormatterRule](https://github.com/pmd/pmd/blob/master/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/multithreading/UnsynchronizedStaticFormatterRule.java)
**Example(s):**
``` java
public class Foo {
private static final SimpleDateFormat sdf = new SimpleDateFormat();
void bar() {
sdf.format(); // poor, no thread-safety
}
synchronized void foo() {
sdf.format(); // preferred
}
}
```
**Use this rule by referencing it:**
``` xml
<rule ref="category/java/multithreading.xml/UnsynchronizedStaticFormatter" />
```
## UseConcurrentHashMap
**Since:** PMD 4.2.6