You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Should org.apache.dubbo.registry.support.AbstractRegistry#getRegistered returns unmodifiable sets? #3106
I notice that the method org.apache.dubbo.registry.support.AbstractRegistry#getRegistered just returns the internal reference of registered, and everyone can modify this Set outside the Registry, is this a good practice?
An example is that in org.apache.dubbo.registry.support.AbstractRegistryTest#testRegister, there is something like:
@kezhenxu94 , what you mentioned I am with it. I think we should keep the responsibility of operation on objects e.g. in this case clearing the registry to the owner of registries object AbstractRegistry.java and when ever it returns any mutable member variable it should return copy of it. But having said that we also needs to consider memory footprint/performance of creating clone copy of returned object. I beleve it should not change memory footprint or performance drastically but better to have some data around it.
I beleve it should not change memory footprint or performance drastically but better to have some data around it.
@khanimteyaz That's my opinion too. What I suggest is to wrap the member variable such as using Collections.unmodifiableSet, and this may break something, so it needs investigation and discussion
I beleve it should not change memory footprint or performance drastically but better to have some data around it.
@khanimteyaz That's my opinion too. What I suggest is to wrap the member variable such as using Collections.unmodifiableSet, and this may break something, so it needs investigation and discussion
Activity
khanimteyaz commentedon Dec 31, 2018
@kezhenxu94 , what you mentioned I am with it. I think we should keep the responsibility of operation on objects e.g. in this case clearing the registry to the owner of registries object AbstractRegistry.java and when ever it returns any mutable member variable it should return copy of it. But having said that we also needs to consider memory footprint/performance of creating clone copy of returned object. I beleve it should not change memory footprint or performance drastically but better to have some data around it.
kezhenxu94 commentedon Dec 31, 2018
@khanimteyaz That's my opinion too. What I suggest is to wrap the member variable such as using
Collections.unmodifiableSet, and this may break something, so it needs investigation and discussionkhanimteyaz commentedon Dec 31, 2018
@kezhenxu94 agree.
beiwei30 commentedon Feb 2, 2019
then, can someone nicely work on it?
kezhenxu94 commentedon Feb 2, 2019
@beiwei30 I'll work on it
[Dubbo-3106]Make getRegistered return unmodifiable collection. #3106 (#…
Merge master branch to 3.x dev branch (#3718)