Multithreading and Concurrency

Multi-threading and Concurrency related collection

ConcurrentModificationException in Java

Carvia Tech | November 21, 2020 | 1 min read | 1,287 views | Multithreading and Concurrency

ConcurrentModificationException is raised by fail-fast iterators when the underlying collection is modified structurally during iteration.

Read Article

What is purpose of Collections.unmodifiableCollection

Carvia Tech | October 03, 2020 | 1 min read | 70 views | Multithreading and Concurrency

What does Collections.unmodifiableCollection() do? Is it safe to use the collection returned by this method in a multi-threading environment?

Read Article

Java 8 Parallel Stream custom ThreadPool

Carvia Tech | August 23, 2020 | 2 min read | 3,876 views | Multithreading and Concurrency

Configure thread pool for Java 8 parallel stream operations - configure default common pool and running parallel stream operation inside ForkJoinPool.

Read Article

ThreadLocal with examples in Java

Carvia Tech | August 11, 2020 | 4 min read | 534 views | Multithreading and Concurrency

ThreadLocal provides a mechanism of maintaining thread confinement for a given object. which allows you to associate a per-thread value with a value-holding object.

Read Article

Difference between Callable and Runnable Interface

Carvia Tech | July 25, 2020 | 2 min read | 573 views | Multithreading and Concurrency

Callable interface is similar to Runnable, in that both are designed for classes whose instances are potentially executed by another thread. A Runnable, however, does not return a result and cannot throw a checked exception.

Read Article

Java Concurrency Interview Questions

Carvia Tech | July 24, 2020 | 2 min read | 1,105 views | Multithreading and Concurrency

top java concurrency and multi-threading interview questions - Java Memory Model, volatile keyword, HashMap, ConcurrentHashMap, fail-safe and fail-fast iterator, immutability, ThreadLocal, Callable and Runnable

Read Article

Removing elements while iterating over a Java Collection

Carvia Tech | December 16, 2019 | 2 min read | 1,035 views | Multithreading and Concurrency

It is not generally permissible for one thread to modify a Collection while another thread is iterating over it. In general, the results of the iteration are undefined under these circumstances.

Read Article

What is Immutable Class in Java

Carvia Tech | December 08, 2019 | 2 min read | 1,409 views | Multithreading and Concurrency

An object is called Immutable when its state can not be changed after its construction. Immutable objects are inherently thread-safe, thus making it easy to write multi-threading code

Read Article

Producer Consumer Problem using Blocking Queue in Java

Carvia Tech | August 31, 2019 | 3 min read | 2,024 views | Multithreading and Concurrency

A producer consumer problem is a typical example of multi-thread synchronization problem where some shared resource (a work queue, blockingqueue) is used by two types of threads - Producer & Consumer

Read Article

Can the keys in HashMap be mutable

Carvia Tech | August 03, 2019 | 2 min read | 1,956 views | Multithreading and Concurrency

Simple answer is No, If we make the keys mutable then the hashcode of the key will no more be consistent over time which will cause lookup failure for that object from hashing data structure

Read Article