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);
}
}
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());
}
Aggregations