Image processing in a multhithreaded mode using Java
Posted
by jadaaih
on Stack Overflow
See other posts from Stack Overflow
or by jadaaih
Published on 2010-06-18T08:30:34Z
Indexed on
2010/06/18
8:33 UTC
Read the original article
Hit count: 342
image
|concurrency
Hi Folks,
I am supposed to process images in a multithreaded mode using Java. I may having varying number of images where as my number of threads are fixed. I have to process all the images using the fixed set of threads.
I am just stuck up on how to do it, I had a look ThreadExecutor and BlockingQueues etc...I am still not clear. What I am doing is, - Get the images and add them in a LinkedBlockingQueue which has runnable code of the image processor. - Create a threadpoolexecutor for which one of the arguements is the LinkedBlockingQueue earlier. - Iterate through a for loop till the queue size and do a threadpoolexecutor.execute(linkedblockingqueue.poll). - all i see is it processes only 100 images which is the minimum thread size passed in LinkedBlockingQueue size.
I see I am seriously wrong in my understanding somewhere, how do I process all the images in sets of 100(threads) until they are all done? Any examples or psuedocodes would be highly helpful
Thanks! J
© Stack Overflow or respective owner