Search in sources :

Example 1 with QuartzScheduler

use of org.apache.sling.commons.scheduler.impl.QuartzScheduler in project sling by apache.

the class VirtualInstanceBuilder method getSingletonScheduler.

public static Scheduler getSingletonScheduler() throws Exception {
    if (singletonScheduler != null) {
        return singletonScheduler;
    }
    final Scheduler newscheduler = new QuartzScheduler();
    final ThreadPoolManager tpm = new DefaultThreadPoolManager(null, null);
    try {
        PrivateAccessor.invoke(newscheduler, "bindThreadPoolManager", new Class[] { ThreadPoolManager.class }, new Object[] { tpm });
    } catch (Throwable e1) {
        org.junit.Assert.fail(e1.toString());
    }
    OSGiMock.activate(newscheduler);
    singletonScheduler = newscheduler;
    return singletonScheduler;
}
Also used : DefaultThreadPoolManager(org.apache.sling.commons.threads.impl.DefaultThreadPoolManager) FailingScheduler(org.apache.sling.discovery.base.its.setup.mock.FailingScheduler) QuartzScheduler(org.apache.sling.commons.scheduler.impl.QuartzScheduler) Scheduler(org.apache.sling.commons.scheduler.Scheduler) QuartzScheduler(org.apache.sling.commons.scheduler.impl.QuartzScheduler) ThreadPoolManager(org.apache.sling.commons.threads.ThreadPoolManager) DefaultThreadPoolManager(org.apache.sling.commons.threads.impl.DefaultThreadPoolManager)

Aggregations

Scheduler (org.apache.sling.commons.scheduler.Scheduler)1 QuartzScheduler (org.apache.sling.commons.scheduler.impl.QuartzScheduler)1 ThreadPoolManager (org.apache.sling.commons.threads.ThreadPoolManager)1 DefaultThreadPoolManager (org.apache.sling.commons.threads.impl.DefaultThreadPoolManager)1 FailingScheduler (org.apache.sling.discovery.base.its.setup.mock.FailingScheduler)1