| A WorkerThreadPool executes a Runnable in the background. For efficiency, a
simple thread pool is maintained. Threads are created when needed,
and a thread with no work to do for ten seconds is destroyed.
It would make sense to use this WorkerThreadPool class in the app manager,
e.g. for xlet lifecycle control, since sending those events is rare.
This class assumes that creation and destruction of java.lang.Thread
instances is relatively expensive. Of course, java.lang.Thread might
do its own pooling of underlying native threads; if this is so,
then it may be somewhat more efficient to just create a new
java.lang.Thread for each call.
|