Hao Zhong created ARIES-1702:
--------------------------------
Summary: A performance bug
Key: ARIES-1702
URL: https://issues.apache.org/jira/browse/ARIES-1702
Project: Aries
Issue Type: Bug
Components: Blueprint
Affects Versions: blueprint-core-1.7.0
Reporter: Hao Zhong
I notice that
DirObjectFactoryHelper.getObjectInstanceUsingObjectFactoryBuilders has the
following code:
for (ServiceReference ref : refs) {
ObjectFactoryBuilder builder = (ObjectFactoryBuilder)
Utils.getServicePrivileged(callerContext, ref);
try {
factory = builder.createObjectFactory(obj, environment);
} catch (NamingException e) {
// TODO: log it
} finally {
callerContext.ungetService(ref);
}
if (factory != null) {
break;
}
}
The above code is copied from a buggy version of
ObjectFactoryHelper.getObjectInstanceUsingObjectFactoryBuilders. Please refer
to ARIES-1068 for details.
The buggy version of ARIES-1068 is identical. Its fixed version is as follow:
ServiceReference[] refs = objFactoryStC.getServiceRefs();
if (refs != null) {
Arrays.sort(refs, Utils.SERVICE_REFERENCE_COMPARATOR);
for (ServiceReference ref : refs) {
if (canCallObjectFactory(obj, ref)) {
ObjectFactory factory = (ObjectFactory)
objFactoryStC.getService(ref);
try {
result = factory.getObjectInstance(obj, name, nameCtx,
environment);
} catch (NamingException ne) {
// Ignore this since we are doing last ditch finding, another
OF might work.
}
// if the result comes back and is not null and not the
reference
// object then we should return the result, so break out of the
// loop we are in.
if (result != null && result != obj) {
break;
}
}
}
}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)