GAE抛出TimedSemaphore的AccessControlException

时间:2015-10-18 10:08:15

标签: java google-app-engine apache-commons-lang

我正在使用Google App Engine(Java),我的战争必须使用TimedSemaphore来控制特定时间段内的资源,但GAE会因为访问不允许的API而抛出众所周知的异常,如下所示。

java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "modifyThreadGroup")
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:457)
at java.security.AccessController.checkPermission(AccessController.java:884)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
at com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkPermission(DevAppServerFactory.java:429)
at com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkAccess(DevAppServerFactory.java:454)
at java.lang.ThreadGroup.checkAccess(ThreadGroup.java:315)
at java.lang.Thread.init(Thread.java:389)
at java.lang.Thread.init(Thread.java:349)
at java.lang.Thread.<init>(Thread.java:674)
at java.util.concurrent.Executors$DefaultThreadFactory.newThread(Executors.java:613)
at java.util.concurrent.ThreadPoolExecutor$Worker.<init>(ThreadPoolExecutor.java:612)
at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:925)
at java.util.concurrent.ThreadPoolExecutor.ensurePrestart(ThreadPoolExecutor.java:1587)
at java.util.concurrent.ScheduledThreadPoolExecutor.delayedExecute(ScheduledThreadPoolExecutor.java:334)
at java.util.concurrent.ScheduledThreadPoolExecutor.scheduleAtFixedRate(ScheduledThreadPoolExecutor.java:573)
at org.apache.commons.lang3.concurrent.TimedSemaphore.startTimer(TimedSemaphore.java:404)
at org.apache.commons.lang3.concurrent.TimedSemaphore.acquire(TimedSemaphore.java:300)

但是,据我所知,The JRE Class White List包含TimedSemaphore调用的所有类。

我的结算状态当然已经激活,以便使用GAE的所有功能。有谁知道它为什么会发生?

1 个答案:

答案 0 :(得分:0)

啊,我意识到我们无法在GAE上调用new Thread()。它描述了here。我必须寻找解决方法..好的。