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

Karthik Kambatla commented on HADOOP-10085:
-------------------------------------------

Sorry for the delay in getting around to this. Looks like the patch doesn't 
apply anymore - was hard to see the changes to tests themselves, mind 
refreshing the patch? I ll try to review before it goes stale this time. 

Let me make sure I understand the fix here. Without the fix, adding a child 
service to a CompositeService while the CompositeService is initing all its 
child services leads to ConcurrentModificationException. The patch allows 
adding these services even during this time, but the newly added child service 
will never be inited if it not already. So, the patch allows adding services 
but places the onus on the caller to make sure it is in the correct state; 
otherwise, bad things can happen. 

I am not sure if it is better to have deterministic behavior where we force 
users to add all the services before CompositeService#serviceInit is called or 
to allow adding services but leave the onus on the users. 

It would have been nicer to have a check for the child being in at least the 
parent's state. Would it make sense to have the parent service enter INIT only 
after all its child services have been INITed? That way, if the parent is 
already in INIT, we can disallow adding a service in UNINITED state. Also, the 
current usage pattern of adding services followed by a call to 
super.serviceInit() will remain valid? 

> CompositeService should allow adding services while being inited
> ----------------------------------------------------------------
>
>                 Key: HADOOP-10085
>                 URL: https://issues.apache.org/jira/browse/HADOOP-10085
>             Project: Hadoop Common
>          Issue Type: Improvement
>    Affects Versions: 2.2.0
>            Reporter: Karthik Kambatla
>            Assignee: Steve Loughran
>         Attachments: HADOOP-10085-002.patch, HADOOP-10085-003.patch
>
>
> We can add services to a CompositeService. However, if we do that while 
> initing the CompositeService, it leads to a ConcurrentModificationException.
> It would be nice to allow adding services even during the init of 
> CompositeService.



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

Reply via email to