protected void activate()

in src/main/java/org/apache/sling/commons/scheduler/impl/GaugesSupport.java [146:176]


    protected void activate(final BundleContext ctx) {
        logger.debug("activate: activating.");
        configHolder = quartzScheduler.configHolder;
        active = true;

        // register the gauges
        registerGauges();

        bundleId = ctx.getBundle().getBundleId();
        try {
            quartzScheduler.addPeriodicJob(bundleId, null, CLEANUP_JOB_NAME, new Runnable() {

                @Override
                public void run() {
                    if (active) {
                        cleanupTemporaryGauges();
                    } // if the GaugesSupport isn't active anymore it is so
                      // because
                      // the QuartzScheduler was deactivated - which means we
                      // don't
                      // have to unregister the periodic job here.
                    else {
                        logger.debug("run: late executed periodic cleanup job - ignoring");
                    }
                }

            }, null, 1800 /* 1800sec == 30min */, false);
        } catch (SchedulerException e) {
            throw new RuntimeException("Could not activate GaugesSupport due to " + e, e);
        }
    }