Java Thread How to - Java Concurrent Example








  1. Java Avoid concurrent execution of a time-consuming task without blocking
  2. Java Call java.util.concurrent.Future.get()
  3. Java Combine putIfAbsent and replace with ConcurrentMap
  4. Java Concurrent Reads from Unmodfiable Map
  5. Java Concurrent reads on an InputStream
  6. Java Coordinate Runnable instance for random periods of time
  7. Java Coordinate sender and receiver with CyclicBarrier
  8. Java Create a timer for every time this int changes
  9. Java Create new fixed thread pool threads
  10. Java Limit the number of concurrent evaluation in parallel streams
  11. Java Make threads end in same order they started
  12. Java Manage order of threads with CyclicBarrier
  13. Java Schedual future tasks
  14. Java Search array with Future
  15. Java Solve dining philosophers monitors
  16. Java Suspend Thread using java.util.concurrent
  17. Java Use BlockingQueue.take method
  18. Java Use ConcurrentHashMap computeIfPresent method
  19. Java Use CyclicBarrier with TimerTask




Latch

  1. Java Compare Countdown latch vs Cyclic barrier
  2. Java Create deadlock with CountDownLatch
  3. Java Use CountDownLatch to coordinate threads

Executor

  1. Java Create new Single Thread Executor
  2. Java Create ThreadPoolExecutor and get pool size
  3. Java Execute threads using ExecutorService
  4. Java Get Active threads in ExecutorService
  5. Java Get threads not run in parallel using ExecutorService
  6. Java Limit ExecutorService for submitted Callable
  7. Java Make threads end in same order they started with an Executor
  8. Java Use ConcurrentHashMap in Executors
  9. Java Use ExecutorService to manage Callable
  10. Java Use ReentrantLock, Future, Callable, ExecutorService
  11. Java Use Scheduled Thread Pool Executor




Fork

  1. Java Do quick sort with ForkJoinPool and RecursiveAction
  2. Java Use Fork/Join to Collect results
  3. Java Wait until all tasks have finished in ForkJoinPool

Callable

  1. Java Execute Callable tasks
  2. Java Make sure that Callable executes sequentially
  3. Java Use Future and Callable to work with subtasks

Producer

  1. Java Implement Producer consumer pattern
  2. Java Solve Producer-Consumer with LinkedList
  3. Java Solve the producer-consumer using semaphores