Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

ServletContextListener and Starting a Thread  RSS feed

Brian Hart
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm looking to 'poll' a database table for new records. I want to have a low priority thread check a database table while the server is running. the run() method of the Runnable would look something like this:

I thought that calling this process from within the contextInitialized(ServletContextEvent event) of a ServletContextListener would be an appropriate place to begin this process. However, on Oracle's OC4J J2EE server, I'm getting the message:
Exception thrown initializing batch completed listener: java.lang.Exception: Not in an application scope - start Orion with the -userThreads switch if using user-created threads
The fact that the server by default discourages user created threads makes me think my approach is a bad one.
Two questions:
1. What is a relatively straightforward approach to implement a simple polling thread on a JSP/Servlet based web application (no EJB, JMS).
2. What are the implications of enabling userThreads on Orion.
Thanks in advance.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!