[ 
https://issues.apache.org/jira/browse/YARN-5276?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15614206#comment-15614206
 ] 

Miklos Szegedi commented on YARN-5276:
--------------------------------------

Thank you for the quick reply [~sandflee]!

It is really optional. I was wondering if we could test at least whether the 
log has arrived. I could come up with a draft but it uses reflection. It is up 
to you, whether you want to do something similar.
{code}
    Log log = Mockito.mock(Log.class);
    AsyncDispatcher dispatcher = new AsyncDispatcher();

    Field logger = AsyncDispatcher.class.getDeclaredField("LOG");
    logger.setAccessible(true);
    Field modifiers = Field.class.getDeclaredField("modifiers");
    modifiers.setAccessible(true);
    modifiers.setInt(logger, logger.getModifiers() & ~Modifier.FINAL );
    Object oldLog = logger.get(null);

    try {
      logger.set(null, log);

      dispatcher.init(new Configuration());
      dispatcher.register(TestEnum.class, new EventHandler() {
        @Override
        public void handle(Event event) {
          try {
            Thread.sleep(1500); // As long as 10000 events queued
          } catch (InterruptedException e) {
          }
        }
      });
      dispatcher.start();
      for (int i = 0; i < 10000; ++i) {
        dispatcher.getEventHandler().handle(new 
TestEvent(TestEnum.TestEventType));
      }
      Mockito.verify(log, Mockito.atLeastOnce()).info("event type: 
TestEventType, num: 5000, capacity: 1.0");
      dispatcher.stop();
    } finally {
      //... restore logger object
    }
{code}

> print more info when event queue is blocked
> -------------------------------------------
>
>                 Key: YARN-5276
>                 URL: https://issues.apache.org/jira/browse/YARN-5276
>             Project: Hadoop YARN
>          Issue Type: Improvement
>          Components: nodemanager, resourcemanager
>            Reporter: sandflee
>            Assignee: sandflee
>              Labels: oct16-easy
>         Attachments: YARN-5276.01.patch, YARN-5276.02.patch, 
> YARN-5276.03.patch, YARN-5276.04.patch
>
>
> we now see logs like "Size of event-queue is 498000, Size of event-queue is 
> 499000" and difficult to know which event flood the queue. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: yarn-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: yarn-issues-h...@hadoop.apache.org

Reply via email to