Hi,
http://java.sun.com/docs/books/tutorial/uiswing/misc/timer.html
maybe useful.
ron
--- Jim Preston <[EMAIL PROTECTED]> wrote:
> No offense intended, but some of the proposed
> solutions to this simple query
> strike me as falling into the "shooting flies with a
> battleship" category;
> you're making it much more complicated than it needs
> to be. And those
> proposing using Cron or JRunScheduler are then
> locked into a particular
> platform.
>
> Why not write a pure Java solution, and let the
> built-in Java mechanisms do
> your timing for you? The sleep method of the Thread
> class takes a duration
> as the parameter. When your servlet/JSP first starts
> up, spawn a thread as
> Krishnan suggested. Rather than spend overhead
> waking up periodically to
> check for the right time, this thread just does a
> simple subtraction to
> calculate how long between "now" and the next time
> you want to do your
> operations, then calls sleep for that duration. When
> it wakes up, it does
> its work, then calculates how long until the next
> wakeup time, and sleeps
> for that duration. A single sleeping thread really
> doesn't take up much in
> the way of resources, so there's no reason you can't
> just leave this thread
> "running" all the time.
>
> Simple, elegant, platform-independent, very low
> resource usage.
>
> --Jim Preston
>
>
> -----Original Message-----
> From: A mailing list about Java Server Pages
> specification and reference
> [mailto:[EMAIL PROTECTED]]On Behalf Of
> Krishnan
> Sent: Wednesday, August 02, 2000 5:31 AM
> To: [EMAIL PROTECTED]
> Subject: How can I schedule a Job in JSP or
> servlet...
>
>
> Hi pals,
> We have to run a servlet or JSP automatically on
> saturday night at 12. We
> are planning to write a servlet and in the init
> method of that servlet,
> planning to invoke a thread which checks for the
> specified time and if
> satisfies, do the necessary operations. We will load
> that servlet at startup
> of the server. I want to know, is there is any other
> possible way of
> achieving the same.
> Your replies are highly appreciated.
>
> rgds
> krishnan
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with
> body: "signoff
> JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>
>
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with
> body: "signoff JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
__________________________________________________
Do You Yahoo!?
Kick off your party with Yahoo! Invites.
http://invites.yahoo.com/
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets