My Blog

My WordPress Blog

My Blog

My WordPress Blog

05. Java Concurrency

ConcurrentNavigableMap Interface

A java.util.concurrent.ConcurrentNavigableMap interface is a subinterface of ConcurrentMap interface, and supports NavigableMap operations, and recursively so for its navigable sub-maps, and approximate matches. ConcurrentMap Methods Sr.No. Method & Description 1 NavigableSet<K> descendingKeySet()Returns a reverse order NavigableSet view of the keys contained in this map. 2 ConcurrentNavigableMap<K,V> descendingMap()Returns a reverse order view of the mappings contained […]

ConcurrentMap Interface

A java.util.concurrent.ConcurrentMap interface is a subinterface of Map interface, supports atomic operations on underlying map variable. It have get and set methods that work like reads and writes on volatile variables. That is, a set has a happens-before relationship with any subsequent get on the same variable. This interface ensures thread safety and atomicity guarantees. […]

BlockingQueue Interface

A java.util.concurrent.BlockingQueue interface is a subinterface of Queue interface, and additionally supports operations such as waiting for the queue to become non-empty before retrieving an element, and wait for space to become available in the queue before storing an element. BlockingQueue Methods Sr.No. Method & Description 1 boolean add(E e)Inserts the specified element into this […]

ScheduledThreadPoolExecutor Class

java.util.concurrent.ScheduledThreadPoolExecutor is a subclass of ThreadPoolExecutor and can additionally schedule commands to run after a given delay, or to execute periodically. ScheduledThreadPoolExecutor Methods Sr.No. Method & Description 1 protected <V> RunnableScheduledFuture<V> decorateTask(Callable<V> callable, RunnableScheduledFuture<V> task)Modifies or replaces the task used to execute a callable. 2 protected <V> RunnableScheduledFuture<V> decorateTask(Runnable runnable, RunnableScheduledFuture<V> task)Modifies or replaces the […]

ThreadPoolExecutor Class

java.util.concurrent.ThreadPoolExecutor is an ExecutorService to execute each submitted task using one of possibly several pooled threads, normally configured using Executors factory methods. It also provides various utility methods to check current threads statistics and control them. ThreadPoolExecutor Methods Sr.No. Method & Description 1 protected void afterExecute(Runnable r, Throwable t)Method invoked upon completion of execution of […]

newSingleThreadExecutor Method

A single thread pool can be obtainted by calling the static newSingleThreadExecutor() method of Executors class. Syntax Where newSingleThreadExecutor method creates an executor that executes a single task at a time. Example The following TestThread program shows usage of newSingleThreadExecutor method in thread based environment. This will produce the following result. Learn Java in-depth with real-world projects […]

newScheduledThreadPool Method

A scheduled thread pool can be obtainted by calling the static newScheduledThreadPool() method of Executors class. Syntax Example The following TestThread program shows usage of newScheduledThreadPool method in thread based environment. This will produce the following result. Learn Java in-depth with real-world projects through our Java certification course. Enroll and become a certified expert to boost your career. […]

newCachedThreadPool Method

A cached thread pool can be obtainted by calling the static newCachedThreadPool() method of Executors class. Syntax where Example The following TestThread program shows usage of newCachedThreadPool method in thread based environment. This will produce the following result. Learn Java in-depth with real-world projects through our Java certification course. Enroll and become a certified expert to boost your […]

Scroll to top