yep
basically get injected the timerservice ( http://docs.oracle.com/javaee/6/api/javax/ejb/TimerService.html), in your init method you try to get your data, if not trigger a later invocation (http://docs.oracle.com/javaee/6/api/javax/ejb/TimerService.html#createSingleActionTimer(java.util.Date, javax.ejb.TimerConfig)). While it fails trigger another one when invoked. When it succeeds you are done. *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 James Green <[email protected]> > In our case we have two EJBs, both @Singleton and @Startup, one depends on > the other. One is a cache façade and the other loads data via JPA and feeds > it into the cache. An external schedule fires a servlet that reloads the > cache from the database. > > What's happening is that without MySQL we see EJB exceptions that they > cannot be created and thus we are dead. > > I've just tried adding autoReconnect=true inside a <Resource> but that made > no difference. I also tried adding ,autoReconnect=true to > ConnectionProperties and ConnectionFactoryProperties without any change but > I'm not convinced that would have fixed the problem here. > > Is it instead the case that within the EJB I should be trapping > connectivity problems such as PersistenceException and allowing the > containing to gracefully start up and naturally keep trying anyway? > > James > > > > On 28 June 2013 17:10, José Luis Cetina <[email protected]> wrote: > > > I had a similar problem and what i did was set the autoReconnect > attribute > > to true en my tomee.xml datasource. > > What do you mean with retry until the connection springs to life? do you > > have some schedules or jobs running and want to retry again when the > > connection is available again? or just want when somebody click any > button > > the app can connect again (this was my case)?? > > > > > > 2013/6/28 Romain Manni-Bucau <[email protected]> > > > > > With an ejb timer? > > > Le 28 juin 2013 17:46, "James Green" <[email protected]> a > écrit > > : > > > > > > > Hopefully a quick one. > > > > > > > > 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 a way to essentially ask the database layer to retry until > the > > > > connection springs to life? > > > > > > > > Thanks, > > > > > > > > James > > > > > > > > > > > > > > > -- > > ------------------------------------------------------------------- > > *SCJA. José Luis Cetina* > > ------------------------------------------------------------------- > > >
