Easy learning with example program codes

difference between callable and runnable

                          Runnable                            Callable
Available in java.lang package.Available in java.util.concurrent package.
Method: void run()Method: V call() throws Exception
It cannot return any value.It can return value.
Read More

callable and future in java

The Callable interface available in java.util.concurrent package. It contains one method call() which returns the Future object. Return value can be retrieved after termination with get.
The … Read More

fork join in java

The ForkJoinPool was introduced in java 7. It works on fork and join principle. In first step (fork) the task splits itself into smaller subtask which will … Read More

Executor framework in java

Executor framework provides the facility to separates the task creation and its execution. We have to pass Runnable objects to the executor and it is the responsibility … Read More

shutdown hook in java

Java shutdown hook is used to perform some operation when JVM is shutting down. It is mainly used to perform clean-up operations like closing log file etc. … Read More

Thread group in java

Thread group in java

The java.lang.ThreadGroup class provides the facility to create the thread group. Thread group provides a way to group multiple threads in a single … Read More

Thread pool in java

Normally, server creates a new thread when a new request comes. This approach have several disadvantages. For creating a new thread for every new request will take … Read More

AtomicLongArray in java

The java.util.concurrent.atomic.AtomicLongArray class represents an array of long which are updated atomically.

Creating an AtomicLongArray

AtomicLongArray array = new AtomicLongArray(5);

It creates an atomic long array of … Read More

AtomicIntegerArray in java

The java.util.concurrent.atomic.AtomicIntegerArray class represents an array of int which are updated atomically.

Creating an AtomicIntegerArray

AtomicIntegerArray array = new AtomicIntegerArray(5);

It creates an atomic integer array of … Read More

atomiclong in java

The java.util.concurrent.atomic.AtomicLong class provides a long variable which can be read and written atomically.

Creating an AtomicLong

AtomicLong atomicLong = new AtomicLong();

Create an atomic long with … Read More

Copyright © 2019 CodesJava Protection Status SiteMap Reference: Java Wiki