Skip to content

Commit

Permalink
Merge pull request #2287 from liangyi9812/fix-VolatileAtomicityDemo
Browse files Browse the repository at this point in the history
fix: 修改VolatileAtomicityDemo中的笔误
  • Loading branch information
Snailclimb authored Feb 28, 2024
2 parents 74ccdbc + 0364454 commit 4637706
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/java/concurrent/java-concurrent-questions-02.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public class Singleton {
* @author Guide哥
* @date 2022/08/03 13:40
**/
public class VolatoleAtomicityDemo {
public class VolatileAtomicityDemo {
public volatile static int inc = 0;

public void increase() {
Expand All @@ -105,11 +105,11 @@ public class VolatoleAtomicityDemo {

public static void main(String[] args) throws InterruptedException {
ExecutorService threadPool = Executors.newFixedThreadPool(5);
VolatoleAtomicityDemo volatoleAtomicityDemo = new VolatoleAtomicityDemo();
VolatileAtomicityDemo volatileAtomicityDemo = new VolatileAtomicityDemo();
for (int i = 0; i < 5; i++) {
threadPool.execute(() -> {
for (int j = 0; j < 500; j++) {
volatoleAtomicityDemo.increase();
volatileAtomicityDemo.increase();
}
});
}
Expand Down

0 comments on commit 4637706

Please sign in to comment.