druid/dev/code-review/concurrency.md
Roman Leventov 46ea5b88b7
Add the pull-request template (#7206)
* Add the pull-request template

* Rewording

* Replaced checklist link, added Rat exclusion

* Update the PR template. Add Concurrency Checklist to the repository

* Merge Description and Design sections. Softer language. Removed requirement to test in production environment. Added a committer's instruction to justify addition of meta tags.

* Rephrase item about comments

* Add license header

* Add item to concurrency checklist
2019-06-27 15:51:25 +03:00

12 KiB
Raw Blame History

Druid's Checklist for Concurrency Code

Design

Documentation

Excessive thread safety

Race conditions

Replacing locks with concurrency utilities

Avoiding deadlocks

Improving scalability

Lazy initialization and double-checked locking

Non-blocking and partially blocking code

Threads and Executors

Parallel Streams

Thread interruption and Future cancellation

Time

Thread safety of Cleaners and native code


# Lk.D1. Is it possible to use Druid's LifecycleLock utility instead of a standard lock and "started" flag in lifecycled objects with start() and stop() methods? See the Javadoc comment for LifecycleLock for more details.

# TE.D1. Are Threads created directly or via a ThreadFactory configured to be daemon via setDaemon(true)? Note that by default, ThreadFactories constructed via Execs.makeThreadFactory() methods create daemon threads already.

# TE.D2. Is it possible to use one of the static factory methods in Druid's Execs utility class to create an ExecutorService instead of Java's standard ExecutorServices? This is recommended because Execs configure ThreadFactories to create daemon threads by default, as required by the previous item.