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:
parent
954e7300e9
commit
c7fee7bb07
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user