
com.anarsoft.vmlens.concurrent.example.RaceConditionMissingSynchronization Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of concurrent-junit Show documentation
Show all versions of concurrent-junit Show documentation
A http://junit.org test runner to run concurrent unit tests.
package com.anarsoft.vmlens.concurrent.example;
import org.apache.commons.lang3.mutable.MutableInt;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import com.anarsoft.vmlens.concurrent.junit.ConcurrentTestRunner;
/**
*
* {@link #addOne} is run by 4 threads in parallel. Since it is not synchronized tools like
* vmlens.com will show a race condition.
*
* @author Thomas
*
*/
@RunWith(ConcurrentTestRunner.class)
public class RaceConditionMissingSynchronization {
private MutableInt mutableInt = new MutableInt();
@Test
public void addOne()
{
mutableInt.add(1);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy