| Author |
ExecutorService with 1 thread
|
Jim Bob
Greenhorn
Joined: Apr 06, 2007
Posts: 2
|
|
Hi There, Can someone answer me this question: If I create an ExecutorService like so: ExecutorService myService = Executors.newFixedThreadPool(1); and then call(pseudocode): myService.submit(sometask1); myService.submit(sometask2); Is it guaranteed that seeing as the ExecutorService only has one thread (see constructor above), is it guaranteed that sometask2 will only execute after sometask1 has finished? In other words, with a pool size of 1, sometask1 and sometask2 will never execute concurrently in this situation?? thanks a lot.
|
 |
Jim Bob
Greenhorn
Joined: Apr 06, 2007
Posts: 2
|
|
No probs....done! - Jim.
|
 |
Scott Selikoff
Saloon Keeper
Joined: Oct 23, 2005
Posts: 3652
|
|
"Jim Bob" Please re-read the section on 'obviously fictitious names' and change your name appropriately.
|
My Blog: Down Home Country Coding with Scott Selikoff
|
 |
Stan James
(instanceof Sidekick)
Ranch Hand
Joined: Jan 29, 2003
Posts: 8791
|
|
|
The Executor interface JavaDoc includes a sample Executor that runs one task at a time, if that's your objective.
|
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
|
 |
 |
|
|
subject: ExecutorService with 1 thread
|
|
|