Search in sources :

Example 1 with MemoryEventQueue

use of org.apache.oozie.event.MemoryEventQueue in project oozie by apache.

the class EventHandlerService method init.

@Override
public void init(Services services) throws ServiceException {
    try {
        Configuration conf = services.getConf();
        LOG = XLog.getLog(getClass());
        Class<? extends EventQueue> queueImpl = (Class<? extends EventQueue>) ConfigurationService.getClass(conf, CONF_EVENT_QUEUE);
        eventQueue = queueImpl == null ? new MemoryEventQueue() : (EventQueue) queueImpl.newInstance();
        eventQueue.init(conf);
        // initialize app-types to switch on events for
        initApptypes(conf);
        // initialize event listeners
        initEventListeners(conf);
        // initialize worker threads via Scheduler
        initWorkerThreads(conf, services);
        eventsEnabled = true;
        LOG.info("EventHandlerService initialized. Event queue = [{0}], Event listeners configured = [{1}]," + " Events configured for App-types = [{2}], Num Worker Threads = [{3}]", eventQueue.getClass().getName(), listenerMap.toString(), apptypes, numWorkers);
    } catch (Exception ex) {
        throw new ServiceException(ErrorCode.E0100, ex.getMessage(), ex);
    }
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) MemoryEventQueue(org.apache.oozie.event.MemoryEventQueue) EventQueue(org.apache.oozie.event.EventQueue) MemoryEventQueue(org.apache.oozie.event.MemoryEventQueue)

Example 2 with MemoryEventQueue

use of org.apache.oozie.event.MemoryEventQueue in project oozie by apache.

the class TestEventHandlerService method testService.

@Test
public void testService() throws Exception {
    EventHandlerService ehs = _testEventHandlerService();
    // check default initializations
    assertTrue(ehs.getEventQueue() instanceof MemoryEventQueue);
    Set<String> jobtypes = ehs.getAppTypes();
    assertTrue(jobtypes.contains("workflow_job"));
    assertTrue(jobtypes.contains("coordinator_action"));
    Services services = Services.get();
    services.destroy();
    services = new Services();
    Configuration conf = services.getConf();
    conf.set(Services.CONF_SERVICE_EXT_CLASSES, "");
    services.init();
    assertFalse(EventHandlerService.isEnabled());
}
Also used : MemoryEventQueue(org.apache.oozie.event.MemoryEventQueue) Configuration(org.apache.hadoop.conf.Configuration) Test(org.junit.Test)

Aggregations

Configuration (org.apache.hadoop.conf.Configuration)2 MemoryEventQueue (org.apache.oozie.event.MemoryEventQueue)2 EventQueue (org.apache.oozie.event.EventQueue)1 Test (org.junit.Test)1