Tuesday, October 08, 2013

Getting WELD working on top of GAE/J

I have a pet project that I keep tinkering with whenever I get some free time. It is an elaborate experiment to build what I wish to call as the "Unified Model Layer". More details about it in another post. As with any experiment there are a lot of observations and learnings. One such learning was on how to get WELD running on top of Google App Engine.

Remember - an App Engine app may not spawn new threads.

Once you understand this rule, then all you need to do is dig through any library code that might want to spawn threads and disable it.

In the case of WELD, you need to create 2 property files, with the associated content:

org.jboss.weld.bootstrap.properties

  # Custom overrides to make weld work in the GAE environment.
  concurrentDeployment=false
  preloaderThreadPoolSize=0


org.jboss.weld.executor.properties

  # Executors should not be created on the GAE environment.
  threadPoolType=NONE

Ensure that these property files end up in your WEB-INF/classes directory. That will ensure that WELD does not spawn new threads at application startup.

Hope this was useful to you.

No comments: