[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [p2-dev] The cache policy of repo manager

Thanks for clarifying it.
opened https://bugs.eclipse.org/bugs/show_bug.cgi?id=299227

On Fri, 2010-01-08 at 16:21 -0500, John Arthorne wrote:
> 
> Please enter a bug report for this. The intent here wasn't to reset
> the remembered suffix, but just to update the repository info stored
> by the repository manager (mainly the name and description). 
> 
> John 
> 
> 
> 
> 
> "Zhu, Mengxin (Kane)"
> <Kane.Zhu@xxxxxxxxxxxxx> 
> Sent by:
> p2-dev-bounces@xxxxxxxxxxx 
> 
> 01/07/2010 03:45 AM 
>          Please respond to
>      P2 developer discussions
>        <p2-dev@xxxxxxxxxxx>
> 
> 
> 
> 
>                To
> <p2-dev@xxxxxxxxxxx> 
>                cc
> 
>           Subject
> [p2-dev] The
> cache policy of
> repo manager
> 
> 
> 
> 
> 
> 
> 
> 
> Hello dev,
> 
> I do debug the implementation of repo manager, and find the repo
> manger
> would cache the location and its corresponding repo that is held by a
> SoftReference object. It won't actually load the repo again for the
> cached location until the cached repo object has been GC. It's a good
> practice, as well improve the performance in case of loading the same
> repo frequently. However, I'm confused by below code snippet,
> 
>                 protected IRepository basicGetRepository(URI location)
> {
> 
>   ......................
>                                                   IRepository repo =
> (IRepository)
> info.repository.get();
>                                                   //update our
> repository info because the
> repository may have changed
>                                                   if (repo != null)
> 
>  addRepository(repo, false, null);
>                                                   return repo;
>                                  }
>                 }
> 
> The comment tells me the repo may have changed, so update the
> repository
> info. If so, why still returns the cached repo though the real repo
> might have changed? Why reset the known suffix for that repo even if
> it's necessary to update the repo info? My understand is that the
> suffix
> escalates the hit rate of loading when there are multiple repo
> factories. If the repo info records a suffix for the location, repo
> manager would firstly use the factory that is bind to the suffix. It's
> also a rare situation that the type of repo is changed. So it would be
> higher hit rate to load the repo again if keeping the value of suffix.
> 
> Kane(Zhu, Meng Xin)
> mail: kane.zhu@xxxxxxxxxxxxx
> 
> _______________________________________________
> p2-dev mailing list
> p2-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/p2-dev
> 
> _______________________________________________
> p2-dev mailing list
> p2-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/p2-dev