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

Sandy Ryza commented on YARN-417:
---------------------------------

Thanks for the detailed comments, Bikas.  Other than what's discussed below, 
I'll make the changes you suggest (switch to wait/notify, you're right about 
the race in the test, will have the heartbeater start in the register method, 
etc.)

bq. Why not wait for the handlerThread to join()?
My thought was that the user should be able to call stop() from the callback 
handler and not deadlock.  Even if we were to explicitly warn against this, 
users would be likely to try it anyway and encounter difficulties.

Regarding synchronization, I had put some thought into it, and my understanding 
is that it should work without synchronized methods.  A coarse version of the 
thinking behind this is:
* All the methods of AMRMClientAsync other than init(), start(), and stop() do 
not touch any variables in AMRMClientAsync and delegate to AMRMClient.  
AMRMClient handles the interleaving of any of these methods with each other, 
and interleaving them with start(), stop(), and init().
* If any of these methods are interleaved with stop(), there will be no problem.
* Calling any of these methods before or at the same time as init() or start() 
is incorrect use of the class, and can cause problems even if the methods are 
synchronized.  Additionally, after the start/register change you proposed, all 
that init() and start will do is delegate to AMRMClient anyway.
Let me know if you see anything I'm missing.
                
> Add a poller that allows the AM to receive notifications when it is assigned 
> containers
> ---------------------------------------------------------------------------------------
>
>                 Key: YARN-417
>                 URL: https://issues.apache.org/jira/browse/YARN-417
>             Project: Hadoop YARN
>          Issue Type: Sub-task
>          Components: api, applications
>    Affects Versions: 2.0.3-alpha
>            Reporter: Sandy Ryza
>            Assignee: Sandy Ryza
>         Attachments: AMRMClientAsync-1.java, AMRMClientAsync.java, 
> YARN-417-1.patch, YARN-417-2.patch, YARN-417-3.patch, YARN-417.patch, 
> YarnAppMaster.java, YarnAppMasterListener.java
>
>
> Writing AMs would be easier for some if they did not have to handle 
> heartbeating to the RM on their own.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to