[concurrency-interest] throwing RuntimeException vs Exception in ThreadPoolExecutor
Kai Meder
stuff at kai.meder.info
Sat May 29 14:08:11 EDT 2010
Hello,
I'm hacking in Scala and use the ThreadPoolExecutor. I use an Exception
"TerminatedChannel", using the trait ControlThrowable, inside my tasks
in for ControlFlow (please no discussion about this).
When using TerminatedChannel as a RuntimeException it passes the
attached ThreadPoolExector-CodeBlock. If used just as a Throwable the
ThreadPoolExecutor suspends the thread, as TerminatedChannel broke its neck.
Is this supposed Java-behaviour? Do I need to declare Exceptions as
RuntimeExceptions to get propagated to the normal catch-clause?
Any advice appreciated very much. Thanks!
public void run() {
try {
Runnable task = firstTask;
firstTask = null;
while (task != null || (task = getTask()) != null) {
runTask(task);
task = null;
}
} finally {
workerDone(this);
}
}
More information about the Concurrency-interest
mailing list