This content has been marked as final.
Show 2 replies
-
1. Re: Reinitialising @startup class
walterjwhite May 24, 2009 4:05 PM (in response to sunsear)Hi Martin,
It depends on exactly what you want to do. It seems to me that this would best work with the Quartz schedule. Run a daily cron job that loads this data.
There are good examples on the Seam website for Quartz Cron jobs:
[Seam&Quartz=>http://docs.jboss.com/seam/2.1.2.CR2/reference/en-US/html/jms.html#d0e21218]
That shows you how to use Quartz with Seam. When the component is started, you could create the cron job. You will need to make that bean dependent on quartzDispatcher in order for it to work then:
`@Startup(depends = "quartzDispatcher")
public DataLoader()
{
loadData(null, "* * * * *", null);// read what expression runs daily, you can configure the time of day and whatnot too
}
@Asynchronous
public QuartzTriggerHandle loadData(@Expiration Date when,
@IntervalCron String cronl,
@FinalExpiration Date endDate)
{
doStuff();
return(null);// Seam intercepts this method call and returns a QuartzTriggerHandle ...
}`
Walter -
2. Re: Reinitialising @startup class
swd847 May 25, 2009 1:05 AM (in response to sunsear)try
Contexts.removeFromAllContexts("componentName"); Component.getInstance("componentName");