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 Executor-framework. Show all posts
Showing posts with label Executor-framework. Show all posts

Java Executor framework tutorial with example

8:08 AM
Java Executor framework tutorial with example Java 5 has introduced new framework called “Executor Framework” for managing threads.We have already seen before how to create a thread. If you have noted, we need to create an object of thread class using new Thread(runnableObject), so we need to create thread object for each task.Imagine a situation where you have thousands of task to be executed and if you create each thread for thousands of tasks, you may get performance overheads as creation and maintenance of each thread is also an overhead. Executor framework will solve the problem. In executor framework, you can create specified number of threads and reuse them to execute more tasks once it completes its current task. Executor framework simplifies the design of creating multithreaded application and manages thread life cycles.The programmer does not have to create or manage threads themselves, that’s the biggest advantage of executor framework. There are some important classes

.