local variable type inference changes (#1042)

* local variable type inference changes

local variable type inference changes for thread pool design pattern

* local variable type inference changes

local variable type inference changes for ThreadPool design pattern
This commit is contained in:
GVSharma 2019-10-26 21:20:47 +05:30 committed by Ilkka Seppälä
parent 954e7300e9
commit c7fee7bb07

View File

@ -81,13 +81,13 @@ public class App {
// unbounded queue. At any point, at most nThreads threads will be active processing
// tasks. If additional tasks are submitted when all threads are active, they will wait
// in the queue until a thread is available.
ExecutorService executor = Executors.newFixedThreadPool(3);
var executor = Executors.newFixedThreadPool(3);
// Allocate new worker for each task
// The worker is executed when a thread becomes
// available in the thread pool
for (int i = 0; i < tasks.size(); i++) {
Runnable worker = new Worker(tasks.get(i));
var worker = new Worker(tasks.get(i));
executor.execute(worker);
}
// All tasks were executed, now shutdown