All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.anarsoft.vmlens.concurrent.example.RaceConditionMissingSynchronization Maven / Gradle / Ivy

There is a newer version: 1.0.2
Show newest version
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