Yeah, EventManager is probably the only piece that is explicitly
starting new threads. It is used by Cayenne runtime to refresh peer
contexts after commits. Without re-reading the App Engine docs, I
can't say whether such operation would even make sense under their
programming model, but still it should be fairly easy to disable EM
thread pool.
This will require some patching of the Configuration class though to
allow installing a noop / nothread implementation of EventManager.
Andrus
On Jul 4, 2009, at 3:52 PM, Bob Schellink wrote:
Hi all,
For fun I've been trying to get Cayenne running on Google App Engine
(GAE) using the in-memory HSQLDB database. GAE has quite a number of
restrictions such as disallowing creation of new threads. More
importantly GAE isn't backed by a RDBMS and so JDBC isn't supported,
however in-memory databases could work (in theory at least).
Anyway trying to get the app running throws the stackTrace below
because Cayenne's EventManager starts new threads. Is this a deal
breaker or are there perhaps a workaround?
kind regards
bob
org.apache.cayenne.conf.Configuration initializeSharedConfiguration:
Error creating shared Configuration:
java.security.AccessControlException: access denied
(java.lang.RuntimePermission modifyThreadGroup)
at java.security.AccessControlContext.checkPermission(Unknown
Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at com.google.apphosting.utils.security.SecurityManagerInstaller
$CustomSecurityManager.checkAccess(SecurityManagerInstaller.java:72)
at java.lang.ThreadGroup.checkAccess(Unknown Source)
at java.lang.Thread.init(Unknown Source)
at java.lang.Thread.<init>(Unknown Source)
at org.apache.cayenne.event.EventManager
$DispatchThread.<init>(EventManager.java:457)
at org.apache.cayenne.event.EventManager.<init>(EventManager.java:
97)
at org.apache.cayenne.event.EventManager.<init>(EventManager.java:
76)
at
org.apache.cayenne.conf.Configuration.<init>(Configuration.java:193)
at
org
.apache
.cayenne.conf.DefaultConfiguration.<init>(DefaultConfiguration.java:
58)
at
org
.apache
.cayenne.conf.DefaultConfiguration.<init>(DefaultConfiguration.java:
46)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown
Source)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at
org
.apache
.cayenne
.conf.Configuration.initializeSharedConfiguration(Configuration.java:
133)
at
org
.apache
.cayenne
.conf.Configuration.initializeSharedConfiguration(Configuration.java:
121)
at
org
.apache
.cayenne
.conf.Configuration.getSharedConfiguration(Configuration.java:91)
at
org
.apache
.cayenne.access.DataContext.createDataContext(DataContext.java:145)
at
org
.apache
.click
.extras.cayenne.CayenneTemplate.getDataContext(CayenneTemplate.java:
169)
at
org
.apache
.click
.extras.cayenne.CayenneTemplate.performQuery(CayenneTemplate.java:276)
at
com.mycorp.service.CustomerService.getCustomers(CustomerService.java:
29)
at com.mycorp.page.ViewCustomers.onRender(ViewCustomers.java:76)
at
org.apache.click.ClickServlet.performOnRender(ClickServlet.java:666)
at org.apache.click.ClickServlet.processPage(ClickServlet.java:521)
at org.apache.click.ClickServlet.handleRequest(ClickServlet.java:
339)
at org.apache.click.ClickServlet.doGet(ClickServlet.java:257)