1

Has anyone used Restlet's TaskService in a Java EE app (deployed in Tomcat, GlassFish, etc)?

Is using it going against Java EE's specifications? How does Restlet deal with it when the server/container maintains the thread pool and NOT go against the Java EE spec of not instantiating your own threads in a container managed application?

Or are you forced to used Spring and/or interface with CommonJ's WorkManger interface for asynchronous processing?

PS: FYI, TaskService basically wraps the ExecutorService of Java 6 - but it's suggested to not used that in an application server context. However, the Java EE version of Restlet does seem to have this service and was wondering if using it would violate the Java EE specs or is a strict no-no or is in fact doable or should one fallback to Spring/CommonJ

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
PhD
  • 11,202
  • 14
  • 64
  • 112

1 Answers1

2

It's not very clear from the Servlet Specification version 2.5 that creation of threads is forbidden inside a servlet container. Cf chapter "SRV.14.2.2 Web Application Environment", page 151 :

This type of servlet container must support lookups of such objects and calls made to those objects when performed on a thread managed by the servlet container. This type of servlet container should support this behavior when performed on threads created by the developer, but are not currently required to do so. Such a requirement will be added in the next version of this specification. Developers are cautioned that depending on this capability for application-created threads is not recommended, as it is non-portable.

I will have a look at the Java EE spec.

Best regards, Thierry Boileau

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140