[jboss-user] [JBoss jBPM] - JbpmThreadServlet and member threads

brado do-not-reply at jboss.com
Thu Jan 25 16:11:19 EST 2007


I was just looking at the JbpmThreadServlet source code (3.1.2), and noticed that there are two threads started by an instance of this class, and are stored as member variables:

CommandExecutorThread commandExecutorThread = null;
  | SchedulerThread schedulerThread = null;
  | ...
  | public void init() throws ServletException {
  | ...    
  |   commandExecutorThread = new CommandExecutorThread(jbpmConfiguration);
  |   commandExecutorThread.start();
  | 
  |   schedulerThread = new SchedulerThread(jbpmConfiguration);
  |   schedulerThread.start();
  | }

Now, correct me if I'm wrong, but although the SingleThreadModel servlet was dropped in newer Servlet specs (2.2 & newer or close as I recall) I believe that management of servlet instances isn't specified by the servlet spec, no? While I cannot necessarily  name you a particular servlet engine that manages servlets through pooling vs. a single servlet instance (because I use almost exclusively Tomcat or embedded Tomcat in JBoss), I can imagine scenarios where you might want to. I believe that it is entirely legal according to the spec for a servlet engine implementer to have more than one instance of a servlet class in existence at the same time. As a result, wouldn't this implementation of the schedulerThread and commandExecutorThread be problematic, as they are tied to instances of this Servlet class, rather than tied as statics to the class itself? You'd have multiple SchedulerThreads and CommandExecutorThreads running at the same time, no? 

Thanks,

Brad

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4006531#4006531

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4006531



More information about the jboss-user mailing list