As you can see from the code below:

      hostAndWeight = new HostAndWeight(host, weight);

      this.hostAndWeights.put(host, hostAndWeight);

Same host reference is used for the key and in the value of the Map.

I think there is not much gain in the proposed change.

On Wed, Jun 22, 2016 at 10:29 PM, WangYQ <wangyongqiang0...@163.com> wrote:

> to ram
> i am not sure if I misunstand the code, so I want to make sure if there is
> any improvements
>
> to ted
> sorry, I make some mistakes in previous description
>
> i mean if we can use guava multiMap:
> private MultiMap<String, Long> hostAndWeight
>
> do not need to store hostname many times
>
>
>
>
> thanks
>
>
> On 2016-06-23 12:50 , Ted Yu <yuzhih...@gmail.com> Wrote:
>
> YQ:
> The HostAndWeight is basically a tuple.
> In getTopHosts(), hosts are retrieved.
> In getWeight(String host), weight is retrieved.
>
> Why do you think a single Long is enough ?
>
> Cheers
>
> On Wed, Jun 22, 2016 at 9:28 PM, ramkrishna vasudevan <
> ramkrishna.s.vasude...@gmail.com> wrote:
>
> > Hi WangYQ,
> >
> > For code related suggestions if you feel there is an improvement or bug
> it
> > is preferrable to raise a JIRA and give a patch. Pls feel free to raise
> a
> > JIRA with your suggestion and why you plan to change it.
> >
> > Regards
> > Ram
> >
> > On Thu, Jun 23, 2016 at 9:36 AM, WangYQ <wangyongqiang0...@163.com>
> wrote:
> >
> > >
> > > there is a class named "HDFSBlockDistribution",  use a tree map
> > > "hostAndWeight" to store data
> > > private Map<String, HostAndWeight> hostAndWeight
> > >
> > > I think we can use
> > > private Map<String, Long> hostAndWeight
> > > to store data
> > >
> > >
> > > thanks
> >
>
>
>
>

Reply via email to