I’m trying to implement an BufferedInputStream that fills the buffer in some background threads.

I’m pretty close but I’m facing some difficulties.
I set up n buffers, and n ThreadPoolJobs, each job x is responsible for filling the buffer x.
Sometimes I get an exception on ThreadPool.addjob

Is it forbidden to add twice the same job on a threadpool ?




see If yours jobs are deleted by threadpool or not…
(the return value of the Job)

in the first case you can not had the SAME instance of a Job…

But you can add many instance of a same Job to a thread Pool.


ok, you’re right, I should create many instances of the same job and return the right thing so that the threadpool kills my job when it’s done