[ 
https://issues.apache.org/jira/browse/ARIES-1702?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Guillaume Nodet closed ARIES-1702.
----------------------------------
    Resolution: Won't Fix

The change has been reverted, see ARIES-1068.

> 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
>            Assignee: Guillaume Nodet
>
> 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)

Reply via email to