Mike Degteariov
SCJP5 | SCWCD5 | SCBCD5 | OCMJEA6
Tim Driven Development | Test until the fear goes away
So does that mean in Thread I should put call the Sleep method as below. Is that advisable?
Putting a thread to sleep is the opposite of what you intend to do, isn't it? It gets less done, whereas you want to get more done.
As I already pointed out in the other topic where you asked about this, the best number of output threads is likely < 10
No, it means that you should do the math as Mike suggested. If the combined memory needs of all threads is a large portion of the available JVM memory, then you have a problem.
Don't know, but it will probably not prevent your problem.Monica. Shiralkar wrote: . . .
So if I put Thread.sleep, it would not work fast as desired but willl there be lesser probabillity of getting a out of memory problem?
. . .
and you create new threads not so often, like one thread every second, then you probably gonna be fine.
Exception in thread "1034" Exception in thread "1032"
ExecutorService tpes = Executors.newFixedThreadPool(threadPoolSize);
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |