> > Hi all
> >
> > I'd like to know if there any plans to add a generic ThreadPool into the
> > commons project, I think there is not a generic one, but several
different
> > ones have been implemented for Tomcat, Turbine and so on...
> >
> > Wouldn't it be nice to define it under (for example) the threading
> > sandbox-subproject?
> >
> > Regards
> >
> >
>
> No one has proposed one yet, although it certainly sounds like the kind of
> thing that would be appropriate. Would you be interested in gathering the
> existing examples together (and/or seeing if we could base a generic one
> off of the "object pool" package), and making a proposal?
>
> Craig
Well, this is the risk proposing nice stuff ;-)
Actually I'm quite interested on developing one. I'll study the current
examples and make a proposal ASAP. In general the idea will be to develop
one out of the ObjectPool, creating some amount of initial threads and
accepting tasks to be execute. This requires the addition of some extra
methods to execute a thread, for instance:
dispatchTask(Runnable runnable)
Should it be there also the capability to name the threads and give them
priority, like;
dispatchTask(Runnable runnable, String name)
dispatchTask(Runnable runnable, String name, int Priority)
What about error handling? Should be required that the tasks never throw an
exception, or the Pool should take care of catching them, at least I prefer
that every task be responsible of their own errors, but with a final
(silent) exception catch to maintain the thread alive
Opinions, Comments?