@Schedule is surely 'no' issue in my app. :)
On Mon, Jul 1, 2013 at 7:45 AM, Romain Manni-Bucau <[email protected]>wrote: > @Schedule has the issue it always runs ;) > > *Romain Manni-Bucau* > *Twitter: @rmannibucau <https://twitter.com/rmannibucau>* > *Blog: **http://rmannibucau.wordpress.com/*< > http://rmannibucau.wordpress.com/> > *LinkedIn: **http://fr.linkedin.com/in/rmannibucau* > *Github: https://github.com/rmannibucau* > > > > 2013/7/1 Howard W. Smith, Jr. <[email protected]> > > > my response below... > > > > On Fri, Jun 28, 2013 at 11:45 AM, James Green <[email protected] > > >wrote: > > > > > > > > On boot our application attempts to read data through a JPA > > EntityManager. > > > If the database connection fails at this point the entire application > is > > > effectively dead. > > > > > > > Is there an assumption or history that has informed you that database was > > not available at boot/startup of the 'app'? > > > > > > > > > > Is there a way to essentially ask the database layer to retry until the > > > connection springs to life? > > > > > > > I really don't see the need for this. I would assume that you can do all > > you need to do with/in a CDI @ApplicationScoped @PostConstruct; this > works > > for me, in my app, but I don't have a need to keep trying to test my > > database connection or retrieve data from my database connection on > startup > > (before any users begin connecting to the app). > > > > However, I do have the following @Schedule 'timer' implementation, which > > checks an email acct every 2 minutes 'after' the app starts, and there is > > code in there that will use JPA to perform SELECT and INSERT operations > > against the database... and the assumption is that the database > connection > > is always valid...after a valid 'start' (which is usually, stop tomee, > > deploy WAR, start tomee). When I have power outages, database always > starts > > successfully when tomee starts via Windows Service when server boots back > > up. using apache derby instead of mysql. > > > > /** > > * > > * @author Administrator > > * > > * http://tomee.apache.org/examples-trunk/access-timeout/README.html > > * http://tomee.apache.org/examples-trunk/access-timeout-meta/ > > * http://docs.oracle.com/cd/E19798-01/821-1841/gipsz/index.html > > */ > > @Singleton > > @Lock(LockType.WRITE) > > @AccessTimeout(value = 2, unit = TimeUnit.MINUTES) > > public class EmailRequestBean { > > > > @Schedule(hour="*", minute="*/2", second="0", persistent=false) > > public void downloadEmailRequests() { > > >
