Quantcast
Channel: Multithreading with AtomicInteger and ExecutorService not working - Stack Overflow
Browsing all 2 articles
Browse latest 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 all 2 articles
Browse latest View live




Latest Images