Sean,

You would probably not write the task as a Servlet.  Instead, as part of your
startup you'd put the task in application scope.  Remember that Servlets/JSPs
that talk to the task are going to do so from different threads (potentially at
the same time).  The task would probably manage its own threads.  If it
executes periodically check out the Timer / TimerTask classes in java.util -
they might save you a fair amount of work.  There's no reason any of this
should be Tomcat-specific.

Sean wrote:

> Hello All,
>
> This is a simular question I asked on the Tomcat mailing list and never got
> a reply.  I was hoping someone could give me some good input on this topic
> from this list.
>
> If I have a process that needs to run within Tomcat&Struts to communicate
> with a remote server, and that process needs it's own thread of execution,
> what would be the best way to go about this in the Tomcat/Servlet container
> world?  I am not sure if each Servlet has it's own thread of execution so I
> wasn't sure if I should just subclass Servlet or HttpServlet.  I am not sure
> of the ramifications of having a bean manage it's own threads and how that
> would effect Tomcat in general.
>
> Does anyone have any pointers, ideas, or suggestions on how they have done
> this or would go about doing this nicely in Tomcat?  Would this be cross
> container code or Tomcat specific?
>
> Thanks,
> Sean

Reply via email to