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

Karthik Kambatla commented on YARN-1574:
----------------------------------------

Nice test, may be we can simplify it further.
# Does MyDispatcher need to hold onto the actual event handlers? Can we use an 
int to keep track of number of handlers and just increment the count on 
register()? 
# Use assertEquals
{code}
+    assertTrue(expectedNumOfEventDispatcher ==
+        ((MyDispatcher) rm.getRMContext().getDispatcher())
+        .getNumOfEventDispatchers());
{code}
# Add this check once after transitionToActive also?
# Nit: Add error message for asserts
# Nit: Rename MyDispatcher to MyCountingDispatcher?
# Nit: Rename getNumOfEventDispatchers() to getEventHandlerCount()?
# Nit: Rename expectedNumOfEventDispatcher to expectedEventHandlerCount?
# Nit: Two stars in the first line of comments?
{code}
+  /*
+   * Register the handlers for alwaysOn services
+   */
+  private Dispatcher setupDispatcher() {
{code}
# Nit: Use single line for the following comment?
{code}
-    rmDispatcher = createDispatcher();
+    /*
+     * Register the handlers for all AlwaysOn services using setupDispatcher().
+     */
+    rmDispatcher = setupDispatcher();
     addIfService(rmDispatcher);
{code}

> When RM transit from Active to Standby, the same eventDispatcher should not 
> be registered more than once
> --------------------------------------------------------------------------------------------------------
>
>                 Key: YARN-1574
>                 URL: https://issues.apache.org/jira/browse/YARN-1574
>             Project: Hadoop YARN
>          Issue Type: Sub-task
>            Reporter: Xuan Gong
>            Assignee: Xuan Gong
>            Priority: Blocker
>         Attachments: YARN-1574.1.patch, YARN-1574.1.patch, YARN-1574.2.patch, 
> YARN-1574.2.patch, YARN-1574.3.patch
>
>
> Currently, we move rmDispatcher out of ActiveService. But we still register 
> the Event dispatcher, such as schedulerDispatcher, RMAppEventDispatcher when 
> we initiate the ActiveService.
> Almost every time when we transit RM from Active to Standby,  we need to 
> initiate the ActiveService. That means we will register the same event 
> Dispatcher which will cause the same event will be handled several times.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to