-
1. Re: Preferred way to run something at start and intermittently?
welle Nov 4, 2010 3:42 AM (in response to brandx)1. How is the database accessed? Entity beans or direct SQL?
2. Why not just setup a no-tx datasource for the MySQL database using a read-only user? perfomance?
3. HSQL is not a production db. You could use a local MySQL and using MySQL master-slave
replication to solve the problem!
PS: Remember that you need to be aware of caching if you not using direct SQL DS.
-
2. Re: Preferred way to run something at start and intermittently?
brandx Nov 4, 2010 11:40 AM (in response to welle)1. Entity beans. Though for my intermittent process, it can be either since all it will do is transfer data, not perform logic on the contents.
2. Performance. Any data processing that can be done outside of the database needs to be done outside of it.
3. Noted. (Though, probably more important is that I'm using the columnDefinition setting in a few of my @Column annotations, which locks my entities in to MySQL. Setting up a local version instead of HSQL isn't a big issue, though.)
-
3. Re: Preferred way to run something at start and intermittently?
brandx Nov 4, 2010 6:49 PM (in response to brandx)So far, the best that I've seen for running something at start is to use a ServletContextListener that I reference in the <listener> tag of web.xml. Should that work alright? If I attach a callback to a timer on a 30 minute delay, should that work fine as well?
-
4. Re: Preferred way to run something at start and intermittently?
jaikiran Nov 5, 2010 1:55 AM (in response to brandx)If you are using JBoss AS6 then you have the Java EE6 spec specified @Startup @Singleton beans which can be used to do your startup activities. Java EE6 also have advanced timer functionality including auto-timers (i.e. you don't have to programatically explicitly create the timers).
-
5. Re: Preferred way to run something at start and intermittently?
brandx Nov 5, 2010 11:39 AM (in response to jaikiran)We're using AS 5 (5.1) and wouldn't want to upgrade to 6 (we're going live in a month or two and wouldn't want to move to a beta version of JBoss for just this).
-
6. Re: Preferred way to run something at start and intermittently?
welle Nov 7, 2010 3:11 PM (in response to brandx)In JBoss 5 you could instead of @Singleton bean use a standard MBean perhaps if you programmatically want to start a thread that does all the work with a sleep() in it.