• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ServletContextListener and Starting a Thread

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic