On Fri, 1 Apr 2005 11:45:40 +0100
"Mark Benussi" <[EMAIL PROTECTED]> wrote:

> I would place your e-mail in a MailManager that queues the messages and
> sends them out on a TimerTask (Every 10 seconds???).
> 
> Secondly from a pernickety perspective I would not have a Servlet doing any
> of what you described. At least place this code a level down in a Manager
> class that can coordinate with the MailManager.
> 
But the MailManager you speak about, doesn't exist in Tomcat.
So, it runs in the Tomcat's jvm (I understood Steve didn't want this) or in 
other jvm ?
And, if it is in another jvm, how your servlet communicate with the MailManager 
?

Rather than TimerTasks, a good issue for these needs could be Quartz 
(http://www.opensymphony.com/quartz/)

> -----Original Message-----
> From: Lionel Farbos [mailto:[EMAIL PROTECTED] 
> Sent: 01 April 2005 11:39
> To: Tomcat Users List
> Cc: [EMAIL PROTECTED]
> Subject: Re: [OT] Proper way to open threads in a servlet
> 
> Your question is not really Tomcat so I put it Off Topic.
> 
> On Fri, 1 Apr 2005 15:24:10 +1000
> "Steve Vanspall" <[EMAIL PROTECTED]> wrote:
> 
> > Hi there,
> > 
> > I am concerned that opening a thread in my serlvet using new
> Thread(Runnable) style code, is causing a massive hang in my system.
> > 
> 
> I don't understand why this hang your system !?...
> You can't do like this but don't forget to daemonize your thread.
> 
> If you don't want your thread to run in the same JVM as Tomcat,
> you can send a message to a daemon; then the daemon (in another JVM and/or
> another server) will receive the messages and treat them (in new Threads).
> To send messages, you can use JMS (so, you need a JMS server) or sockets TCP
> or UDP (see java.net).
> 
> 
> 
> > Basically what the thread does is email people to notify them of a change
> in an order on the system.
> > 
> > I want the emails to be sent in a separate thread so that the user doesn't
> have to wait for this to complete to return to the system.
> > 
> > Basically the email is a non crucial part, the action has already been
> performed. I know this isn't specifically a Tomcat question, but I thought I
> would ask it anyway.
> > 
> > The two ways this could work is that the email is placed in a queue, that
> is checked periodically, or just somehow the email(s) are sent in the
> background, but without opening a new thread using code.
> > 
> > Can anyone give me some pointers on how to do this. Yes I have been
> searching around, but haven't found much information.
> > 
> > Tahnks in advance
> > 
> > Steve
> > 
> > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to