RE: Using Non-Servlet Timers (Was - I need to run a servlet periodically)
It's also a good idea to use the Timer(boolean) constructor to create the associated thread as a daemon. The default constructor doesn't do this. Quoting Sexton, George [EMAIL PROTECTED]: Register a context listener and free the timer in it. -Original Message- From: gautam [mailto:[EMAIL PROTECTED]] Sent: 09 October, 2002 9:53 PM To: Tomcat Users List Subject: Using Non-Servlet Timers (Was - I need to run a servlet periodically) Hello, We are using java.util.Timer objects to periodically run through a few object caches and get rid of stale items. Everything works fine. However, I can no longer stop Tomcat using the Catalina.bat stop command. I suspect that the Timer objects are still alive and are the cause of the problem. Any ideas on how to fix this ? The objects we schedule via the timers are not Servlets. They are plain vanilla Java classes. Regards, Gautam Satpathy -Original Message- From: Rick Fincher [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 10, 2002 12:01 AM To: Tomcat Users List Subject: Re: I need to run a servlet periodically Hi Filip, Your servlet can call a class (doesn't have to be a servlet) that sets up a java.util.timer to run your code as a timerTask. The servlet can get parameters from the web.xml file (like how often to execute) and pass that to your class that controls the timer. The servlet can pass your class the connection pool info and other needed session info. Rick - Original Message - From: Cato, Christopher [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, October 09, 2002 9:04 AM Subject: SV: I need to run a servlet periodically What you really need to do is to design your periodical servlet to implement Runnable. Add another servlet that starts the periodical servlet and load that servlet during startup. The periodical then does its thing and sleeps for x amount of time. Then wakes up and so on... /Christopher -Ursprungligt meddelande- Fran: Raj Saini Till: Tomcat Users List Skickat: 2002-10-07 23:24 Amne: Re: I need to run a servlet periodically To need the servlet run periodically you need a client calling the servlet periodically. Make your client to run periodically and it will cause the servlet to run. We can suggest you a solution if you let us know what exactly you want your servlet to do. Raj Saini Filip Rachunek wrote: Hello, is it possible to have a servlet in Tomcat container which is invoked automatically each gived time period? [e.g. each 10 minutes] And I would also need this special servlet to access other resources of my web application [connection pool, ...]. Thanks. Filip Rachunek -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: I need to run a servlet periodically
To need the servlet run periodically you need a client calling the servlet periodically. Make your client to run periodically and it will cause the servlet to run. We can suggest you a solution if you let us know what exactly you want your servlet to do. Raj Saini Filip Rachunek wrote: Hello, is it possible to have a servlet in Tomcat container which is invoked automatically each gived time period? [e.g. each 10 minutes] And I would also need this special servlet to access other resources of my web application [connection pool, ...]. Thanks. Filip Rachunek __ Do you Yahoo!? Faith Hill - Exclusive Performances, Videos More http://faith.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
SV: I need to run a servlet periodically
What you really need to do is to design your periodical servlet to implement Runnable. Add another servlet that starts the periodical servlet and load that servlet during startup. The periodical then does its thing and sleeps for x amount of time. Then wakes up and so on... /Christopher -Ursprungligt meddelande- Fran: Raj Saini Till: Tomcat Users List Skickat: 2002-10-07 23:24 Amne: Re: I need to run a servlet periodically To need the servlet run periodically you need a client calling the servlet periodically. Make your client to run periodically and it will cause the servlet to run. We can suggest you a solution if you let us know what exactly you want your servlet to do. Raj Saini Filip Rachunek wrote: Hello, is it possible to have a servlet in Tomcat container which is invoked automatically each gived time period? [e.g. each 10 minutes] And I would also need this special servlet to access other resources of my web application [connection pool, ...]. Thanks. Filip Rachunek __ Do you Yahoo!? Faith Hill - Exclusive Performances, Videos More http://faith.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: I need to run a servlet periodically
Hi Filip, i think this it is a bad idea, to invoke a (Runnable) servlet via start(). In what state will be the servlet context, what about the ServletRequest or the log() method for example ? I think the result will depend on server implementation details, but it is very likely to get IllegalStateExceptions at least. As already being said: a) If you need servlet functionality periodically let a cron job do servlet requests periodically b) If you don't need servlet functionality just let a cron job do the job Greetings Wolfgang Stein -Original Message- From: Cato, Christopher [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 09, 2002 3:04 PM To: '[EMAIL PROTECTED]' Subject: SV: I need to run a servlet periodically What you really need to do is to design your periodical servlet to implement Runnable. Add another servlet that starts the periodical servlet and load that servlet during startup. The periodical then does its thing and sleeps for x amount of time. Then wakes up and so on... /Christopher -Ursprungligt meddelande- Fran: Raj Saini Till: Tomcat Users List Skickat: 2002-10-07 23:24 Amne: Re: I need to run a servlet periodically To need the servlet run periodically you need a client calling the servlet periodically. Make your client to run periodically and it will cause the servlet to run. We can suggest you a solution if you let us know what exactly you want your servlet to do. Raj Saini Filip Rachunek wrote: Hello, is it possible to have a servlet in Tomcat container which is invoked automatically each gived time period? [e.g. each 10 minutes] And I would also need this special servlet to access other resources of my web application [connection pool, ...]. Thanks. Filip Rachunek -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: I need to run a servlet periodically
Hi Filip, Your servlet can call a class (doesn't have to be a servlet) that sets up a java.util.timer to run your code as a timerTask. The servlet can get parameters from the web.xml file (like how often to execute) and pass that to your class that controls the timer. The servlet can pass your class the connection pool info and other needed session info. Rick - Original Message - From: Cato, Christopher [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, October 09, 2002 9:04 AM Subject: SV: I need to run a servlet periodically What you really need to do is to design your periodical servlet to implement Runnable. Add another servlet that starts the periodical servlet and load that servlet during startup. The periodical then does its thing and sleeps for x amount of time. Then wakes up and so on... /Christopher -Ursprungligt meddelande- Fran: Raj Saini Till: Tomcat Users List Skickat: 2002-10-07 23:24 Amne: Re: I need to run a servlet periodically To need the servlet run periodically you need a client calling the servlet periodically. Make your client to run periodically and it will cause the servlet to run. We can suggest you a solution if you let us know what exactly you want your servlet to do. Raj Saini Filip Rachunek wrote: Hello, is it possible to have a servlet in Tomcat container which is invoked automatically each gived time period? [e.g. each 10 minutes] And I would also need this special servlet to access other resources of my web application [connection pool, ...]. Thanks. Filip Rachunek -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Using Non-Servlet Timers (Was - I need to run a servlet periodically)
Hello, We are using java.util.Timer objects to periodically run through a few object caches and get rid of stale items. Everything works fine. However, I can no longer stop Tomcat using the Catalina.bat stop command. I suspect that the Timer objects are still alive and are the cause of the problem. Any ideas on how to fix this ? The objects we schedule via the timers are not Servlets. They are plain vanilla Java classes. Regards, Gautam Satpathy -Original Message- From: Rick Fincher [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 10, 2002 12:01 AM To: Tomcat Users List Subject: Re: I need to run a servlet periodically Hi Filip, Your servlet can call a class (doesn't have to be a servlet) that sets up a java.util.timer to run your code as a timerTask. The servlet can get parameters from the web.xml file (like how often to execute) and pass that to your class that controls the timer. The servlet can pass your class the connection pool info and other needed session info. Rick - Original Message - From: Cato, Christopher [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, October 09, 2002 9:04 AM Subject: SV: I need to run a servlet periodically What you really need to do is to design your periodical servlet to implement Runnable. Add another servlet that starts the periodical servlet and load that servlet during startup. The periodical then does its thing and sleeps for x amount of time. Then wakes up and so on... /Christopher -Ursprungligt meddelande- Fran: Raj Saini Till: Tomcat Users List Skickat: 2002-10-07 23:24 Amne: Re: I need to run a servlet periodically To need the servlet run periodically you need a client calling the servlet periodically. Make your client to run periodically and it will cause the servlet to run. We can suggest you a solution if you let us know what exactly you want your servlet to do. Raj Saini Filip Rachunek wrote: Hello, is it possible to have a servlet in Tomcat container which is invoked automatically each gived time period? [e.g. each 10 minutes] And I would also need this special servlet to access other resources of my web application [connection pool, ...]. Thanks. Filip Rachunek -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Using Non-Servlet Timers (Was - I need to run a servlet periodically)
Register a context listener and free the timer in it. -Original Message- From: gautam [mailto:[EMAIL PROTECTED]] Sent: 09 October, 2002 9:53 PM To: Tomcat Users List Subject: Using Non-Servlet Timers (Was - I need to run a servlet periodically) Hello, We are using java.util.Timer objects to periodically run through a few object caches and get rid of stale items. Everything works fine. However, I can no longer stop Tomcat using the Catalina.bat stop command. I suspect that the Timer objects are still alive and are the cause of the problem. Any ideas on how to fix this ? The objects we schedule via the timers are not Servlets. They are plain vanilla Java classes. Regards, Gautam Satpathy -Original Message- From: Rick Fincher [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 10, 2002 12:01 AM To: Tomcat Users List Subject: Re: I need to run a servlet periodically Hi Filip, Your servlet can call a class (doesn't have to be a servlet) that sets up a java.util.timer to run your code as a timerTask. The servlet can get parameters from the web.xml file (like how often to execute) and pass that to your class that controls the timer. The servlet can pass your class the connection pool info and other needed session info. Rick - Original Message - From: Cato, Christopher [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, October 09, 2002 9:04 AM Subject: SV: I need to run a servlet periodically What you really need to do is to design your periodical servlet to implement Runnable. Add another servlet that starts the periodical servlet and load that servlet during startup. The periodical then does its thing and sleeps for x amount of time. Then wakes up and so on... /Christopher -Ursprungligt meddelande- Fran: Raj Saini Till: Tomcat Users List Skickat: 2002-10-07 23:24 Amne: Re: I need to run a servlet periodically To need the servlet run periodically you need a client calling the servlet periodically. Make your client to run periodically and it will cause the servlet to run. We can suggest you a solution if you let us know what exactly you want your servlet to do. Raj Saini Filip Rachunek wrote: Hello, is it possible to have a servlet in Tomcat container which is invoked automatically each gived time period? [e.g. each 10 minutes] And I would also need this special servlet to access other resources of my web application [connection pool, ...]. Thanks. Filip Rachunek -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
I need to run a servlet periodically
Hello, is it possible to have a servlet in Tomcat container which is invoked automatically each gived time period? [e.g. each 10 minutes] And I would also need this special servlet to access other resources of my web application [connection pool, ...]. Thanks. Filip Rachunek __ Do you Yahoo!? Faith Hill - Exclusive Performances, Videos More http://faith.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: I need to run a servlet periodically
Filip Rachunek wrote: Hello, is it possible to have a servlet in Tomcat container which is invoked automatically each gived time period? [e.g. each 10 minutes] And I would also need this special servlet to access other resources of my web application [connection pool, ...]. You're making a mistake. A Java Servlet is a Java component that responds to a web request. That's it - nothing more, nothing less, just what it is designed for. It is not designed to be a cron job. Something like that doesn't belong to a web application - or should we say, to the web GUI part of a web application. In a full JEE application which has a web portal (like Tomcat), you would place such a cron job somewhere other than a web interface. I'm not sure where, I'm no expert on JEE (yet). This was like asking can CGI script be configured to run at regular intervals?. Of course you could run a cron job that would act as a web client and send a request that would fire up that CGI or Servlet. But that is going slightly around it. And doing it at the wrong point. Web applications are request driven application and should not be twisted into something unnatural. Use a regular cron job for this. Nix. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: I need to run a servlet periodically
Unless you are just trying to do refresh, in which case you could use the meta-tags to do auto-refresh and server-push. If you were trying to do a servlet that managed something always running, then you would want a daemon that could handle live-updates. Please be more clear on the usage. Malachi 10/5/2002 3:47:59 AM, Nikola Milutinovic [EMAIL PROTECTED] wrote: Filip Rachunek wrote: Hello, is it possible to have a servlet in Tomcat container which is invoked automatically each gived time period? [e.g. each 10 minutes] And I would also need this special servlet to access other resources of my web application [connection pool, ...]. You're making a mistake. A Java Servlet is a Java component that responds to a web request. That's it - nothing more, nothing less, just what it is designed for. It is not designed to be a cron job. Something like that doesn't belong to a web application - or should we say, to the web GUI part of a web application. In a full JEE application which has a web portal (like Tomcat), you would place such a cron job somewhere other than a web interface. I'm not sure where, I'm no expert on JEE (yet). This was like asking can CGI script be configured to run at regular intervals?. Of course you could run a cron job that would act as a web client and send a request that would fire up that CGI or Servlet. But that is going slightly around it. And doing it at the wrong point. Web applications are request driven application and should not be twisted into something unnatural. Use a regular cron job for this. Nix. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]