Answer by Bedla for Multithreading with AtomicInteger and ExecutorService not...
AtomicInteger is thread safe, but you have called AtomicInteger#get before all tasks finished. ExecutorService#shutdown is not waiting for tasks to finish.See ExecutorService#shutdown docs:This method...
View ArticleMultithreading with AtomicInteger and ExecutorService not working
public class SynchroExample { public final AtomicInteger integer = new AtomicInteger(0); private ExecutorService service = Executors.newFixedThreadPool(100); public void syn() { for (int i = 0; i <...
View Article