I already used the thread pool infrastructure around Executors before, but there is something missing from the Executors static factory class.
A scaling thread poll that discards threads after a timeout, but still has a maximum thread number (and puts additional tasks into a queue). This is the synthesis of two factory methods, newCachedThreadPool (as needed, reuse, 0 to +infinite threads, kills after timeout) and newFixedThreadPool (as needed, reuse, upper and lower thread limit).
I even bothered people on the java concurrency mailing list but, since it was quite complex to do myself, and their response was "would be nice to have in core" variant, so i passed over it.
Until i found this blog post, that describes exactly what i wanted and how
to do it:
http://www.kimchy.org/juc-executorservice-gotcha/
Mostrar mensagens com a etiqueta java. Mostrar todas as mensagens
Mostrar mensagens com a etiqueta java. Mostrar todas as mensagens
segunda-feira, 20 de abril de 2009
Subscrever:
Mensagens (Atom)