Top "Java.util.concurrent" questions

Java package which contains utility classes commonly useful in concurrent programming.

ConcurrentHashMap.newKeySet() vs Collections.newSetFromMap()

Java 8 introduced new way to obtain a concurrent Set implementation // Pre-Java-8 way to create a concurrent set Set<String&…

java set java-8 java.util.concurrent concurrenthashmap
Behavior of entrySet().removeIf in ConcurrentHashMap

I would like to use ConcurrentHashMap to let one thread delete some items from the map periodically and other threads …

java multithreading java.util.concurrent concurrenthashmap concurrentmodification
Is an executor meant to be reused?

Is an executor object meant to be reused after a shutdown? I mean if I call shutdown or shutdownNow after …

java concurrency executorservice java.util.concurrent
ConcurrentHashMap.put V.S. ConcurrentHashMap.replace

From the Javadoc I know ConcurrentHashMap.replace is atomic, but what about ConcurrentHashMap.put? I see they are differently implemented …

java concurrency map java.util.concurrent concurrenthashmap
When is CopyOnWriteArraySet useful to achieve thread-safe HashSet?

In Java, there is thread-safe version HashMap named ConcurrentHashMap and thread-safe version TreeMap named ConcurrentSkipListMap, but there is no ConcurrentHashSet …

java multithreading collections concurrency java.util.concurrent
Can I use the work-stealing behaviour of ForkJoinPool to avoid a thread starvation deadlock?

A thread starvation deadlock occurs in a normal thread pool if all the threads in the pool are waiting for …

java multithreading concurrency java.util.concurrent fork-join
future.cancel does not work

I have a nice and compact code, which does not work as I expected. public class Test { public static void …

java java.util.concurrent