tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leonardo K. Shikida" <shik...@gmail.com>
Subject Re: Are custom quartz schedulers persisted somewhere?
Date Wed, 16 Sep 2015 16:38:50 GMT
actually there's a preDestroy

    @PreDestroy
    public void stop() {
        try {
            System.out.println("scheduler stopping");
            scheduler.shutdown();
            System.out.println("scheduler stopped");
        } catch (SchedulerException e) {
            e.printStackTrace();
        }
    }


I'm going to try quartz list then

thx

[]

Leo

On Wed, Sep 16, 2015 at 12:10 PM, Romain Manni-Bucau <rmannibucau@gmail.com>
wrote:

> Wait a sec, you dont rely on tomee scheduling so maybe you should ask
> quartz list there.
>
> Singleton is created once per app deployment so likely a missing preDestroy
> or so to cleanup your quartz.
> Le 16 sept. 2015 07:39, "Leonardo K. Shikida" <shikida@gmail.com> a écrit
> :
>
> > On server restart, may this singleton be deserialized and postConstruct
> be
> > called again, trying to recreate a scheduler that already exists?
> >
> > []
> >
> > Leo
> >
> > On Wed, Sep 16, 2015 at 11:13 AM, Romain Manni-Bucau <
> > rmannibucau@gmail.com>
> > wrote:
> >
> > > Hi
> > >
> > > By default we store it in memory but with the proper config it can be
> in
> > a
> > > database or anywhere
> > > Le 16 sept. 2015 07:10, "Leonardo K. Shikida" <shikida@gmail.com> a
> > écrit
> > > :
> > >
> > > > Hi
> > > >
> > > > I am using a custom quartz scheduler in tomee 1.6.0 like this
> > > >
> > > > @Startup
> > > > @Singleton
> > > > @DependsOn("SystemInitializerEJB")
> > > > public class TimerEJB{
> > > >
> > > >     private Scheduler scheduler;
> > > >
> > > >     @PostConstruct
> > > >     public void initialize() throws SchedulerException{
> > > >         log.info("Initialize "+this);
> > > >         StdSchedulerFactory factory = new StdSchedulerFactory();
> > > >
> > > >
> > > >
> > >
> >
> factory.initialize(this.getClass().getResourceAsStream("my.quartz.properties"));
> > > >         scheduler = factory.getScheduler();
> > > >         scheduler.start();
> > > >         log.info("scheduler
> > > "+scheduler.getMetaData().getSchedulerName());
> > > >     }
> > > >
> > > > (...)
> > > >
> > > > Because I need to have full control over it and I don't want to mix
> it
> > > with
> > > > the default TomEE quartz scheduler.
> > > >
> > > > I've noticed that sometimes, on server start, I get a message warning
> > > that
> > > > the scheduler already exists. But since it's a singleton, I am
> assuming
> > > it
> > > > will be created only once.
> > > >
> > > > my.quartz.properties does not look special
> > > >
> > > >
> > > >
> > >
> >
> #============================================================================
> > > > # Configure Main Scheduler Properties
> > > >
> > > >
> > >
> >
> #============================================================================
> > > >
> > > > org.quartz.scheduler.instanceName = MyScheduler2
> > > > org.quartz.scheduler.instanceId = AUTO
> > > >
> > > >
> > > >
> > >
> >
> #============================================================================
> > > > # Configure ThreadPool
> > > >
> > > >
> > >
> >
> #============================================================================
> > > >
> > > > org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
> > > > org.quartz.threadPool.threadCount = 10
> > > > org.quartz.threadPool.threadPriority = 5
> > > >
> > > > it does not define a jobStore or a data source
> > > >
> > > > Does TomEE/Quartz serializes the scheduler or stores it somewhere?
> > > >
> > > > []
> > > >
> > > > Leo
> > > >
> > >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message