0

I'm using Google App Engine (Java) and my war has to use TimedSemaphore to control resources within specific time period but GAE throws well-known exceptions due to accessed to disallowed API as follows.

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)

However, as far as my understanding, The JRE Class White List contains all of classes called by TimedSemaphore.

My billing status is of course already active in order to use all features of GAE. Does anyone know why it happens?

pot8os
  • 11
  • 4

1 Answers1

0

Ah, I realized we can't invoke new Thread() on GAE. It's described here. I have to look for the workaround.. Okay.

pot8os
  • 11
  • 4
  • We can define `new TimedSemaphore(new ScheduledThreadPoolExecutor(1, ThreadManager.currentRequestThreadFactory()), 1, TimeUnit.MINUTES, 4800)` and above exception will gone but it doesn't work due to limitations of GAE. – pot8os Oct 18 '15 at 16:01