Reputation: 261
My English is not good. but I need to know about newfixedthreadpool's .
enter code here
ExecutorService executorService = new FixedThreadPool().newFixedThreadPool(4);
.....
public class FixedThreadPool {
private ExecutorService newFixedThreadPool(int nThreads) {
return new ThreadPoolExecutor(nThreads, nThreads,
0L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<Runnable>());
}
}
.....
executorService.execute(new CoreThreadPool(list, resCountClass));
when zip file is unzipping, each entry file is executed and encrypted in those threadpool. [ unzip -> encrypt(pool) -> zip ]
When I did UNIT test(only unzip->encrypt->zip) in eclipse, It showed a good performance(30% higher) against sequential processing(my old project). But after the project deployed in Jboss, the part(unzip->encrypt->zip)'s performance showed a slight better(5%) or the same with a sequential processing. sometimes it was lower. *tested at Linux and Windows
I want to know why the result shows like that. and I need to sort it out.. can i change the queue LinkedBlockingQueue to the other?? Task thread can run by asynchronus??
please, give the answer or hint ..
Cheers mate!!!
Upvotes: 2
Views: 172
Reputation: 533530
Most likely you are using a shared resource to it's maximum e.g. the speed you can read and write to disk or your third level cache. These things can prevent you from efficiently using more CPU. To solve the problem you have work out what your bottleneck is.
Upvotes: 2