Mantis - Resin
Viewing Issue Advanced Details
4889 minor always 12-02-11 12:08 02-21-12 16:55
closed 4.0.24  
none 4.0.26  
0004889: Static calls to Alarm create Threads
The AlarmClock created in Alarm as a static class declaration calls ThreadPool.getThreadPool which spawns new threads. It seems unnecessary to spawn threads unless they are really needed, particularly simply upon class initialization.

This causes issues running on Google App Engine, because their sandbox does not permit thread creation.

This results in GoogleQuercusServlet failing to serve PHP because PageManager calls Alarm.isActive.

WARNING: Nested in java.lang.ExceptionInInitializerError: access denied (java.lang.RuntimePermission modifyThreadGroup)
    at java.lang.SecurityManager.checkPermission(
    at java.lang.ThreadGroup.checkAccess(
    at java.lang.Thread.init(
    at java.lang.Thread.<init>(
    at com.caucho.env.thread.ThreadLauncher.startWorkerThread(
    at com.caucho.env.thread.AbstractTaskWorker.wake(
    at com.caucho.env.thread.AbstractThreadLauncher.update(
    at com.caucho.env.thread.ThreadLauncher.setPriorityIdleMin(
    at com.caucho.env.thread.ThreadLauncher.<init>(
    at com.caucho.env.thread.ThreadPool.<init>(
    at com.caucho.env.thread.ThreadPool.<init>(
    at com.caucho.env.thread.ThreadPool.getThreadPool(
    at com.caucho.util.AlarmClock.<init>(
    at com.caucho.util.Alarm.<clinit>(
Rep by M. Frank

There are no notes attached to this issue.