aries-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hao Zhong (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (ARIES-1702) A performance bug
Date Fri, 17 Mar 2017 01:12:41 GMT

    [ https://issues.apache.org/jira/browse/ARIES-1702?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15929281#comment-15929281
] 

Hao Zhong edited comment on ARIES-1702 at 3/17/17 1:11 AM:
-----------------------------------------------------------

Please note that DirObjectFactoryHelper.getObjectInstanceUsingObjectFactories has the same
problem.


was (Author: haozhong):
Please not that DirObjectFactoryHelper.getObjectInstanceUsingObjectFactories has the same
problem.

> 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)

Mime
View raw message