tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dakota Jack <dakota.j...@gmail.com>
Subject Re: How to run servlet for every 30 minutes in Tomcat 4.1.30
Date Wed, 22 Dec 2004 07:54:46 GMT
Why don't you guys use something like Lea's multithreading queues?

Jack


On Tue, 21 Dec 2004 18:14:30 +0100, Jorge Sopena <jsopena@sidsa.es> wrote:
> Hi,
> I'm having a similar problem in my application.
> I've got several servlets called by the users. Every requets save some
> information in DB, that has to be sent to another server later and in a
> compress format.
> So I need sth similar toShilpa is asking, a process which runs every  X
> minutes to recover the information and send it to the Server.
> 
> My solution to this problem was to implement a "ServletContextListener"
> inside Tomcat.
> When Tomcat starts my application the "contextInitialized" method is
> called, and then a thread is started to do the task explained above.
> I use "Thread.sleep(step)" to wait for the next execution.
> 
> I didn't find anyway to set a timer for a servlet, and I didn't like the
> option of creating an external script .
> 
> Any other  suggestions to solver this problem?
> 
> Thanks
> 
> Jorge
> 
> 
> Ben Souther wrote:
> 
> >On Tue, 2004-12-21 at 11:28, Allistair Crossley wrote:
> >
> >
> >>no, and I believe doing so it bad practice. use some OS controlled timer like
cron to issue a HTTP call to your servlet. I once wrote a shell script that calls a http address
on the local machine but cannot remember how ;) if you are using oracle then you can setup
this timer thread inside the database itself. don't add a thread into your web application.
> >>
> >>
> >>
> >
> >I concur. It's certainly possible to write a treaded java object that
> >fires a command every so often but there would be no point in making
> >that object a servlet (servlets exist to answer client requests).
> >It's also, IMHO, more aggravation than it's worth to manage your own
> >daemon threads in a webapp.
> >
> >It would take all of 2 minutes to write a timer with crontab and wget
> >that could call your servlet whenever you want.
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >
> >
> >
> >
> 
> 


-- 
"You can lead a horse to water but you cannot make it float on its back."

~Dakota Jack~

"You can't wake a person who is pretending to be asleep."

~Native Proverb~

"Each man is good in His sight. It is not necessary for eagles to be crows."

~Hunkesni (Sitting Bull), Hunkpapa Sioux~

-----------------------------------------------

"This message may contain confidential and/or privileged information.
If you are not the addressee or authorized to receive this for the
addressee, you must not use, copy, disclose, or take any action based
on this message or any information herein. If you have received this
message in error, please advise the sender immediately by reply e-mail
and delete this message. Thank you for your cooperation."

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message