Skip to content

Latest commit

 

History

History
22 lines (17 loc) · 944 Bytes

File metadata and controls

22 lines (17 loc) · 944 Bytes

Working with Java Executor framework in multithreaded application

Java Executor Service

Java Executor Service

Thread Pool Executor

Thread Pool Executor

Steps

  • Create an executor
    • The newFixedThreadPool () returns a ThreadPoolExecutor instance with an initialized and unbounded queue and a fixed number of threads.
    • The newCachedThreadPool () returns a ThreadPoolExecutor instance initialized with an unbounded queue and unbounded number of threads.
  • Create one or more tasks and put in the queue
  • Submit the task to the Executor
  • Execute the task
  • Shutdown the Executor

Examples

  • ExecutorServiceExample

References