| BuddyPolicy dependents are not sorted [message #1073092] |
Wed, 24 July 2013 01:56  |
Jakob Braeuchi Messages: 69 Registered: July 2009 Location: Switzerland |
Member |
|
|
hi,
i'm debugging a strange problem with BuddyPolicy.
in my target platform i have 5 version of bundle A (version 1.0.0_xx14 - 1.0.0_xx18). Bundle A is also a registered buddy of Bundle B.
Sometimes when Bundle B requests a class from it's buddy A, the class is loaded from an older version of Bundle A.
after some digging in the classes RegisteredPolicy and DependentPolicy i found that the order of the BundleDesriptors in the variable allDependents is random. Thus the class is loaded from the Bundle A that appears first in the list.
i think that the list allDependents should be sorted by version descending (the method toString() of BundleDescriptor could be used).
what do you think about it ? will the additional sorting cause some performance problems ? or is this simply the wrong place to sort ?
thanks
jakob
|
|
|
|
| Re: BuddyPolicy dependents are not sorted [message #1073291 is a reply to message #1073261] |
Wed, 24 July 2013 09:29   |
Jakob Braeuchi Messages: 69 Registered: July 2009 Location: Switzerland |
Member |
|
|
hi thomas,
thanks for your answer.
Does the list allDependents really grow after it has been filtered in the constructor of RegisteredPolicy:
public RegisteredPolicy(BundleLoader requester) {
super(requester);
//Filter the dependents;
if (allDependents == null)
return;
for (Iterator<BundleDescription> iter = allDependents.iterator(); iter.hasNext();) {
BundleLoaderProxy proxy = buddyRequester.getLoaderProxy(iter.next());
if (proxy == null)
iter.remove();
...
}
//After the filtering, if nothing is left then null out the variable for optimization
if (allDependents.size() == 0)
allDependents = null;
}
jakob
[Updated on: Wed, 24 July 2013 09:30] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.01758 seconds