0

我正在使用 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)

但是,据我了解,JRE 类白名单包含 TimedSemaphore 调用的所有类。

为了使用 GAE 的所有功能,我的帐单状态当然已经处于活动状态。有谁知道为什么会这样?

4

1 回答 1

0

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

于 2015-10-18T10:24:03.487 回答