Well, for Throwable's ThreadDeath, apparently we do need to throw it so the thread *will* die: http://docs.oracle.com/javase/7/docs/api/java/lang/ThreadDeath.html, http://c2.com/cgi/wiki?JavaExceptionsAreParticularlyEvil) AlexPopiel's sample in the second link has this code:

  try {
        someUserClass.run();
  } catch (Thread**Death t) {
        throw t;
  } catch (Throwable t) {
        System.err.print("User supplied code failed:");
        t.printStackTrace(System.err);
  }


I just put code similar to this in for TaskScheduler, I'm not sure of the need yet for WorkerThread, as unlike TaskScheduler it's *doing* but not *calling* tasks (and would like to continue even if a single task it calls throws a throwable) and not trapping Throwable allows the Throwable to percolate up to the TaskScheduler, where it can be properly handled.

BTW, are you sure the two cases in org.apache.roller.weblogger.business.GuiceWebloggerProvider can't rely on Exception instead of Throwable? I kept those two at Throwable per your earlier comment on them but is seems like Exception may be good enough for those.

Regards,
Glen

On 08/09/2013 07:14 PM, Anil Gangolli wrote:

Glen,

We might want to leave the catch Throwable for the two cases below to avoid the possibility of the corresponding thread dying.

--a.



On 8/9/13 7:42 AM, [email protected] wrote:
Author: gmazza
Date: Fri Aug  9 14:42:46 2013
New Revision: 1512325

URL:http://svn.apache.org/r1512325
Log:
Various Sonar complaints fixed, removed Planet Utilities class in favor of using Roller one throughout.
...
roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/runnable/TaskScheduler.java
roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/runnable/WorkerThread.java
...


Reply via email to