Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 12aca38

Browse files
committed
Rephrase T.1, add question 'What is the worst thing that might happen if the code has a concurrency bug?'
1 parent d5d3769 commit 12aca38

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

‎README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ Race conditions
8585
`putAll()` under the lock?](#synchronized-collection-iter)
8686

8787
Testing
88-
- [Unit tests for thread-safe classes are multi-threaded?](#multi-threaded-tests)
88+
- [Considered adding multi-threaded unit tests for a thread-safe classes?](#multi-threaded-tests)
89+
- [What is the worst thing that might happen if the code has a concurrency bug?
90+
](#multi-threaded-tests)
8991
- [A shared `Random` instance is *not* used from concurrent test workers?](#concurrent-test-random)
9092
- [Concurrent test workers coordinate their start?](#coordinate-test-workers)
9193
- [There are more test threads than CPUs (if possible for the test)?](#test-workers-interleavings)
@@ -744,8 +746,16 @@ collections.
744746
### Testing
745747

746748
<a name="multi-threaded-tests"></a>
747-
[#](#multi-threaded-tests) T.1. **Are unit tests for thread-safe classes multi-threaded?**
748-
Single-threaded tests don't really test the thread safety and concurrency.
749+
[#](#multi-threaded-tests) T.1. **Was it considered to add multi-threaded unit tests for a
750+
thread-safe classes?** Single-threaded tests don't really test the thread safety and concurrency.
751+
Note that this question doesn't mean to indicate that there *must* be concurrent unit tests for
752+
every piece of concurrent code in the project because correct concurrent tests take a lot of effort
753+
to write and therefore they might often have low ROI.
754+
755+
**What is the worst thing that might happen if this code has a concurrency bug?** is a useful
756+
question to inform the decision about writing concurrent tests. The consequences may range from a
757+
tiny, entirely undetectable memory leak, to storing corrupted data in a durable database or
758+
a security breach.
749759

750760
<a name="concurrent-test-random"></a>
751761
[#](#concurrent-test-random) T.2. **Isn't a shared `java.util.Random` object used for data

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /