Re: Fire off asynch task in Tomcat.

2010-07-31 Thread Wesley Acheson
This is very useful for me slightly different circumstance. +1 On Thu, Jul 22, 2010 at 10:17 AM, Pid wrote: > On 22/07/2010 05:58, Eric P wrote: > > Hi all, > > > > In my Tomcat app I'm looking for a good (or commonly used) method for > > firing off an asynchronous task. For example, a user re

Re: Fire off asynch task in Tomcat.

2010-07-29 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 André, On 7/23/2010 2:22 PM, André Warnier wrote: > You can of course imagine which language I was thinking of. #!/usr/bin/perl use Perl::MailSendFromDbQueue; go("mydb", "user", "pass"); #end -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (M

Re: Fire off asynch task in Tomcat.

2010-07-23 Thread André Warnier
Christopher Schultz wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Eric, On 7/22/2010 7:41 PM, Eric P wrote: I'll probably go w/the email queue/database table approach. All the points André and Christopher raised gave me further insight into the robustness of this approach (loose coupli

Re: Fire off asynch task in Tomcat.

2010-07-23 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Eric, On 7/22/2010 7:41 PM, Eric P wrote: > I'll probably go w/the email queue/database table approach. All the > points André and Christopher raised gave me further insight into the > robustness of this approach (loose coupling w/the app, no extra l

Re: Fire off asynch task in Tomcat.

2010-07-22 Thread Eric P
Christopher Schultz wrote: > Oh, and one more thing: any in-memory solution you come up with (that is, without writing to a database) is likely to suffer from loss of jobs in the event of a crash or poorly-coded exception-handling. This isn't necessarily a case for using a separate process just

Re: Fire off asynch task in Tomcat.

2010-07-22 Thread Pid
On 22/07/2010 15:37, André Warnier wrote: > Mikolaj Rydzewski wrote: >> On 07/22/2010 03:49 PM, Martin Gainty wrote: >>> //i wasnt able to determine JMX ability to schedule a specific task >>> for a specific time? >>> >> >> I was referring to Andre's sentence: >> "[using database] makes it easi

Re: Fire off asynch task in Tomcat.

2010-07-22 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Eric, On 7/22/2010 12:56 PM, Christopher Schultz wrote: > Eric, > > On 7/22/2010 12:58 AM, Eric P wrote: >> One idea would be to insert a record into a database table that >> signifies an email should be sent to the user. This table could be >> regu

Re: Fire off asynch task in Tomcat.

2010-07-22 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 André, On 7/22/2010 4:33 AM, André Warnier wrote: > André Warnier wrote: > Talking further to myself, I'll add that it also makes it easier to > suspend/resume the sending of emails separately if you need to for some > reason, without having to change

Re: Fire off asynch task in Tomcat.

2010-07-22 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Eric, On 7/22/2010 12:58 AM, Eric P wrote: > One idea would be to insert a record into a database table that > signifies an email should be sent to the user. This table could be > regularly checked by a scheduled job (e.g., a TimerTask) that runs eve

Re: Fire off asynch task in Tomcat.

2010-07-22 Thread André Warnier
Mikolaj Rydzewski wrote: On 07/22/2010 03:49 PM, Martin Gainty wrote: //i wasnt able to determine JMX ability to schedule a specific task for a specific time? I was referring to Andre's sentence: "[using database] makes it easier to suspend/resume the sending of emails separately if you n

Re: Fire off asynch task in Tomcat.

2010-07-22 Thread Mikolaj Rydzewski
On 07/22/2010 03:49 PM, Martin Gainty wrote: //i wasnt able to determine JMX ability to schedule a specific task for a specific time? I was referring to Andre's sentence: "[using database] makes it easier to suspend/resume the sending of emails separately if you need to for some reason, w

RE: Fire off asynch task in Tomcat.

2010-07-22 Thread Martin Gainty
nt donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. > Date: Thu, 22 Jul 2010 11:19:19 +0200 > From: m...@ceti.pl > To: users@tomcat.apache.org > Subject: Re: Fire off asynch task in

Re: Fire off asynch task in Tomcat.

2010-07-22 Thread Mikolaj Rydzewski
On 07/22/2010 10:33 AM, André Warnier wrote: Talking further to myself, I'll add that it also makes it easier to suspend/resume the sending of emails separately if you need to for some reason, without having to change anything to your running webapp. I know, it is certainly less exciting than

Re: Fire off asynch task in Tomcat.

2010-07-22 Thread André Warnier
André Warnier wrote: Eric P wrote: Hi all, In my Tomcat app I'm looking for a good (or commonly used) method for firing off an asynchronous task. For example, a user registers for an account, and an a task to send a verification email to the user is triggered w/o delaying the response to th

Re: Fire off asynch task in Tomcat.

2010-07-22 Thread Mikolaj Rydzewski
On 07/22/2010 10:17 AM, Pid wrote: Have a look at Executors.class in java.util.concurrent. You can start/stop an ExecutorService in the init/destroy methods of your Servlet, submit a Runnable to the ExecutorService representing the job(s) you want to execute. Timer / TimerTask might be an

Re: Fire off asynch task in Tomcat.

2010-07-22 Thread Pid
On 22/07/2010 05:58, Eric P wrote: > Hi all, > > In my Tomcat app I'm looking for a good (or commonly used) method for > firing off an asynchronous task. For example, a user registers for an > account, and an a task to send a verification email to the user is > triggered w/o delaying the response

Re: Fire off asynch task in Tomcat.

2010-07-22 Thread André Warnier
Eric P wrote: Hi all, In my Tomcat app I'm looking for a good (or commonly used) method for firing off an asynchronous task. For example, a user registers for an account, and an a task to send a verification email to the user is triggered w/o delaying the response to the user (i.e., task hap

Re: Fire off asynch task in Tomcat.

2010-07-21 Thread Padam J Singh
Eric, You can use a simple Consumer/Producer pattern here. See the java.util.Queue classes. What I have done in a similar situation is create a single Queue, multiple consumer threads all blocking on the same queue. A user action puts something in the queue, and one of the thread comes out of