@Test(timeout=10000) public void testDispatchStopOnTimeout() throws Exception { BlockingQueue<Event> eventQueue = new LinkedBlockingQueue<Event>(); eventQueue = spy(eventQueue); // simulate dispatcher is not drained. when(eventQueue.isEmpty()).thenReturn(false); YarnConfiguration conf = new YarnConfiguration(); conf.setInt(YarnConfiguration.DISPATCHER_DRAIN_EVENTS_TIMEOUT, 2000); DrainDispatcher disp = new DrainDispatcher(eventQueue); disp.init(conf); disp.setDrainEventsOnStop(); disp.start(); disp.waitForEventThreadToWait(); disp.close(); }
@Test(timeout=10000) public void testDispatchStopOnTimeout() throws Exception { BlockingQueue<Event> eventQueue = new LinkedBlockingQueue<Event>(); eventQueue = spy(eventQueue); // simulate dispatcher is not drained. when(eventQueue.isEmpty()).thenReturn(false); YarnConfiguration conf = new YarnConfiguration(); conf.setInt(YarnConfiguration.DISPATCHER_DRAIN_EVENTS_TIMEOUT, 2000); DrainDispatcher disp = new DrainDispatcher(eventQueue); disp.init(conf); disp.setDrainEventsOnStop(); disp.start(); disp.waitForEventThreadToWait(); disp.close(); } }
@Test(timeout=10000) public void testDispatchStopOnTimeout() throws Exception { BlockingQueue<Event> eventQueue = new LinkedBlockingQueue<Event>(); eventQueue = spy(eventQueue); // simulate dispatcher is not drained. when(eventQueue.isEmpty()).thenReturn(false); YarnConfiguration conf = new YarnConfiguration(); conf.setInt(YarnConfiguration.DISPATCHER_DRAIN_EVENTS_TIMEOUT, 2000); DrainDispatcher disp = new DrainDispatcher(eventQueue); disp.init(conf); disp.setDrainEventsOnStop(); disp.start(); disp.waitForEventThreadToWait(); disp.close(); } }
@SuppressWarnings({ "unchecked", "rawtypes" }) @Test(timeout=10000) public void testDispatcherOnCloseIfQueueEmpty() throws Exception { BlockingQueue<Event> eventQueue = spy(new LinkedBlockingQueue<Event>()); Event event = mock(Event.class); doThrow(new InterruptedException()).when(eventQueue).put(event); DrainDispatcher disp = new DrainDispatcher(eventQueue); disp.init(new Configuration()); disp.setDrainEventsOnStop(); disp.start(); // Wait for event handler thread to start and begin waiting for events. disp.waitForEventThreadToWait(); try { disp.getEventHandler().handle(event); Assert.fail("Expected YarnRuntimeException"); } catch (YarnRuntimeException e) { Assert.assertTrue(e.getCause() instanceof InterruptedException); } // Queue should be empty and dispatcher should not hang on close Assert.assertTrue("Event Queue should have been empty", eventQueue.isEmpty()); disp.close(); }
@SuppressWarnings({ "unchecked", "rawtypes" }) @Test(timeout=10000) public void testDispatcherOnCloseIfQueueEmpty() throws Exception { BlockingQueue<Event> eventQueue = spy(new LinkedBlockingQueue<Event>()); Event event = mock(Event.class); doThrow(new InterruptedException()).when(eventQueue).put(event); DrainDispatcher disp = new DrainDispatcher(eventQueue); disp.init(new Configuration()); disp.setDrainEventsOnStop(); disp.start(); // Wait for event handler thread to start and begin waiting for events. disp.waitForEventThreadToWait(); try { disp.getEventHandler().handle(event); Assert.fail("Expected YarnRuntimeException"); } catch (YarnRuntimeException e) { Assert.assertTrue(e.getCause() instanceof InterruptedException); } // Queue should be empty and dispatcher should not hang on close Assert.assertTrue("Event Queue should have been empty", eventQueue.isEmpty()); disp.close(); }
@SuppressWarnings({ "unchecked", "rawtypes" }) @Test(timeout=10000) public void testDispatcherOnCloseIfQueueEmpty() throws Exception { BlockingQueue<Event> eventQueue = spy(new LinkedBlockingQueue<Event>()); Event event = mock(Event.class); doThrow(new InterruptedException()).when(eventQueue).put(event); DrainDispatcher disp = new DrainDispatcher(eventQueue); disp.init(new Configuration()); disp.setDrainEventsOnStop(); disp.start(); // Wait for event handler thread to start and begin waiting for events. disp.waitForEventThreadToWait(); try { disp.getEventHandler().handle(event); Assert.fail("Expected YarnRuntimeException"); } catch (YarnRuntimeException e) { Assert.assertTrue(e.getCause() instanceof InterruptedException); } // Queue should be empty and dispatcher should not hang on close Assert.assertTrue("Event Queue should have been empty", eventQueue.isEmpty()); disp.close(); }
dispatcher.start(); metricsPublisher = new TimelineServiceV2Publisher(rmTimelineCollectorManager) {
dispatcher.start(); CyclicBarrier syncBarrier = new CyclicBarrier(2); OutputCommitter committer = new TestingOutputCommitter(syncBarrier, true);
dispatcher.start(); OutputCommitter committer = Mockito.mock(OutputCommitter.class); CommitterEventHandler commitHandler =
rmDispatcher.start();
@SuppressWarnings({ "rawtypes" }) @Test(timeout=10000) public void testDrainDispatcherDrainEventsOnStop() throws Exception { YarnConfiguration conf = new YarnConfiguration(); conf.setInt(YarnConfiguration.DISPATCHER_DRAIN_EVENTS_TIMEOUT, 2000); BlockingQueue<Event> queue = new LinkedBlockingQueue<Event>(); DrainDispatcher disp = new DrainDispatcher(queue); disp.init(conf); disp.register(DummyType.class, new DummyHandler()); disp.setDrainEventsOnStop(); disp.start(); disp.waitForEventThreadToWait(); dispatchDummyEvents(disp, 2); disp.close(); assertEquals(0, queue.size()); } }
drainDispatcher.register(RMNodeEventType.class, generic); drainDispatcher.init(new YarnConfiguration()); drainDispatcher.start(); NodeId nodeId = BuilderUtils.newNodeId("host", 3425); ApplicationId appId = BuilderUtils.newApplicationId(1, 1);
drainDispatcher.register(RMNodeEventType.class, generic); drainDispatcher.init(new YarnConfiguration()); drainDispatcher.start(); NodeId nodeId = BuilderUtils.newNodeId("host", 3425); ApplicationId appId = BuilderUtils.newApplicationId(1, 1);
drainDispatcher.register(RMNodeEventType.class, generic); drainDispatcher.init(new YarnConfiguration()); drainDispatcher.start(); NodeId nodeId = BuilderUtils.newNodeId("host", 3425); ApplicationId appId = BuilderUtils.newApplicationId(1, 1);
drainDispatcher.register(RMNodeEventType.class, generic); drainDispatcher.init(new YarnConfiguration()); drainDispatcher.start(); NodeId nodeId = BuilderUtils.newNodeId("host", 3425); ApplicationId appId = BuilderUtils.newApplicationId(1, 1);
DrainDispatcher dispatcher = new DrainDispatcher(); dispatcher.init(conf); dispatcher.start(); CyclicBarrier syncBarrier = new CyclicBarrier(2); OutputCommitter committer = new TestingOutputCommitter(syncBarrier, true);
drainDispatcher.register(RMNodeEventType.class, generic); drainDispatcher.init(new YarnConfiguration()); drainDispatcher.start(); NodeId nodeId = BuilderUtils.newNodeId("host", 3425); ApplicationId appId = BuilderUtils.newApplicationId(1, 1);