tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tom Drake" <...@pobox.com>
Subject Re: Periodically Refresh Application Bean?
Date Sun, 13 Jan 2002 04:33:00 GMT
Rick:

There is no need to restart Tomcat just update the 
data stored in your bean.

You could provide a jsp or servlet that maps the input
parameter names / values to setter methods in your 
application bean. Then your external process simply 
needs to send a URL GET (or POST) request with 
the new data.

Alternatively, you could write a class that implements 
ServletContextListener and that also implements Runnable. 
This class could start itself in a new thread in the 
contextInitialized() method. The run() method could wake 
up every now and then and go and get the 'updated' data
you need, then update your Application scope bean.
Don't forget to provide the means to stop your thread in 
the contextDestroyed() method.

The 2.3 Servlet spec features really provide elegant
ways of solving many of the problems that required 
container specific hacks in earlier spec versions.

Good Luck

Tom Drake
----- Original Message ----- 
From: "Rick Roberts" <techinfo@ait-web.com>
To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
Sent: Saturday, January 12, 2002 12:52 PM
Subject: Periodically Refresh Application Bean?


| I have an application that has a bean with application scope.
| I would like to run a cron job once a day to refresh the data in this 
| bean.  It would be nice if I did not have to restart Tomcat everytime. 
| Anyone know how I could do this?
| 
| Thanks,
| 
| -- 
| *******************************************
| * Rick Roberts                            *
| * Advanced Information Technologies, Inc. *
| *******************************************
| 
| 
| --
| To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
| For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
| Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>
| 
| 
| 


--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message