JavaGian java tutorial and java interview question and answer

JavaGian , Free Online Tutorials, JavaGian provides tutorials and interview questions of all technology like java tutorial, android, java frameworks, javascript, ajax, core java, sql, python, php, c language etc. for beginners and professionals.

Showing posts with label ThreadPoolExecutor. Show all posts
Showing posts with label ThreadPoolExecutor. Show all posts

Java ThreadPoolExecutor example

8:13 AM
Java ThreadPoolExecutor example Java 5 has introduced new concurrent API called “Executor frameworks” to make programmer life easy. It simplifies design and development of multi-thread applications. It consists of mainly Executor, ExecutorService interface and ThreadPoolExecutor class which implements both interfaces i.e. Executor and ExecutorService. ThreadPoolExecutor class provide the implementation of thread pool. We will understand more about it in the later part of the tutorial. Why do we need Executor framework? When we create a simple multi threading application, we create  Runnable objects and construct Thread object using Runnable, We need to create, execute and manage thread. It may be difficult for us to do that. Executor Framework does it for you. It is responsible for creating, executing and managing the thread and not only this, it improves the performance of the application too. When you follow task per thread policy, you create a new thread for e...

.