[concurrency-interest] ScheduledThreadPoolExecutor and shutdown permission check.

Tom Hawtin Thomas.Hawtin at Sun.COM
Wed Apr 30 13:27:40 EDT 2008


Gregg Wonderly wrote:
> I have a STPE that I use in an applet.  At applet shutdown, I'd like to shutdown 
> the executor, but alas it requests a Permission check for a RuntimePermission 
> that I don't have in an unsigned applet.  It seems kind of silly to demand this 
> permission when no other thread management permission exist in the JDK for 
> applets.  Am I missing something in consideration of this issue?

If you really needed to do this, you could:
  * Supply a custom ThreadFactory that (weakly) records created threads.
  * Supply a custom queue.
  * On requiring your threads to shutdown, make the queue start throwing 
runtime exceptions.
  * Then, interrupt all of your remembered threads.

Tom Hawtin


More information about the Concurrency-interest mailing list