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

Guillaume Nodet edited comment on ARIES-1068 at 2/19/18 10:09 AM:
------------------------------------------------------------------

Further minor tweak for ServiceTrackerCustomizers:

ungetService can throw an IllegalStateException if the bundle is no longer 
valid, and this code needs to silently ignore this

Line 330:
{code}
try {
        _callerContext.ungetService(reference);
      } catch (IllegalStateException e) {
        //Shouldn't matter that we get an IllegalStateException here.
        if (LOGGER.isLoggable(Level.FINE)) LOGGER.log(Level.FINE, 
"IllegalStateException ungetting " + reference + " from " + _callerContext);
      }
{code}

Line 422:
{code}
try {
                      bCtx.ungetService(serviceRef);
                    } catch (IllegalStateException e) {
                      //Shouldn't matter that we get an IllegalStateException 
here.
                      if (LOGGER.isLoggable(Level.FINE)) LOGGER.log(Level.FINE, 
"CacheBundleTrackerCustomizer.removedBundle IllegalStateException ungetting " + 
serviceRef + " from " + bCtx);
                    }
{code}



was (Author: sgormley):
Further minor tweak for ServiceTrackerCustomizers:

ungetService can throw an IllegalStateException if the bundle is no longer 
valid, and this code needs to silently ignore this

Line 330:
try {
        _callerContext.ungetService(reference);
      } catch (IllegalStateException e) {
        //Shouldn't matter that we get an IllegalStateException here.
        if (LOGGER.isLoggable(Level.FINE)) LOGGER.log(Level.FINE, 
"IllegalStateException ungetting " + reference + " from " + _callerContext);
      }

Line 422:
try {
                      bCtx.ungetService(serviceRef);
                    } catch (IllegalStateException e) {
                      //Shouldn't matter that we get an IllegalStateException 
here.
                      if (LOGGER.isLoggable(Level.FINE)) LOGGER.log(Level.FINE, 
"CacheBundleTrackerCustomizer.removedBundle IllegalStateException ungetting " + 
serviceRef + " from " + bCtx);
                    }

> JNDI lookup performance bad when security enabled
> -------------------------------------------------
>
>                 Key: ARIES-1068
>                 URL: https://issues.apache.org/jira/browse/ARIES-1068
>             Project: Aries
>          Issue Type: Bug
>          Components: JNDI
>            Reporter: Simon Gormley
>            Assignee: Jeremy Hughes
>            Priority: Critical
>         Attachments: servicelookupperf.patch
>
>
> JNDI lookups can be slow if Java security is enabled, specifically the 
> getService methods take time.
> If the services are cached then the lookup only has to be performed once, but 
> care has to be taken that the context performing the service lookup has the 
> required permissions to do so, and so cache buckets for each context will be 
> necessary. 
> Also to prevent a leak, when contexts drop from scope, the associated caches 
> need to be cleared out.
> The ServiceTrackerCustomizer for JNDI already had some caching ability, and 
> the provided patch extends this to avoid looking up Services where possible.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to