Quantcast
Channel: Multithreading with AtomicInteger and ExecutorService not working - Stack Overflow
Browsing latest articles
Browse All 2 View Live

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 Article



Multithreading 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
Browsing latest articles
Browse All 2 View Live




Latest Images