Merge pull request #8694 from fanatixan/master

corrected typo
This commit is contained in:
Loredana Crusoveanu 2020-02-09 20:36:02 +02:00 committed by GitHub
commit cabff07ff2
2 changed files with 4 additions and 4 deletions

View File

@ -4,7 +4,7 @@ package com.baeldung.concurrent.volatilekeyword;
public class SharedObject {
private volatile int count=0;
void increamentCount(){
void incrementCount(){
count++;
}
public int getCount(){

View File

@ -10,7 +10,7 @@ public class SharedObjectManualTest {
public void whenOneThreadWrites_thenVolatileReadsFromMainMemory() throws InterruptedException {
SharedObject sharedObject = new SharedObject();
Thread writer = new Thread(() -> sharedObject.increamentCount());
Thread writer = new Thread(() -> sharedObject.incrementCount());
writer.start();
Thread.sleep(100);
@ -31,11 +31,11 @@ public class SharedObjectManualTest {
@Test
public void whenTwoThreadWrites_thenVolatileReadsFromMainMemory() throws InterruptedException {
SharedObject sharedObject = new SharedObject();
Thread writerOne = new Thread(() -> sharedObject.increamentCount());
Thread writerOne = new Thread(() -> sharedObject.incrementCount());
writerOne.start();
Thread.sleep(100);
Thread writerTwo = new Thread(() -> sharedObject.increamentCount());
Thread writerTwo = new Thread(() -> sharedObject.incrementCount());
writerTwo.start();
Thread.sleep(100);