You can cache the bean so the lookup is only done once.

to("bean:foo?cache=true")

In Camel 3.x there is a new scope option instead

On Thu, Jun 25, 2020 at 5:09 PM Martin Lichtin
<[email protected]> wrote:
>
> Is there a way to tell Camel to not search OSGi services when looking up a 
> bean?
>
> It seems by default it's continuously looking up the service references, 
> would like to turn this off.
>
> Stack Trace    Sample Count    Percentage(%)
> java.util.TreeMap.getEntryUsingComparator(Object)    17    3.753
>     java.util.TreeMap.getEntry(Object)    17    3.753
>        java.util.TreeMap.get(Object)    17    3.753
> org.apache.felix.framework.ServiceRegistrationImpl.getProperty(String) 11    
> 2.428
> org.apache.felix.framework.ServiceRegistrationImpl$ServiceReferenceMap.get(Object)
>  11    2.428
> org.apache.felix.framework.capabilityset.CapabilitySet.match(Set, 
> SimpleFilter)    11    2.428
> org.apache.felix.framework.capabilityset.CapabilitySet.match(SimpleFilter, 
> boolean)    9    1.987
> org.apache.felix.framework.ServiceRegistry.getServiceReferences(String, 
> SimpleFilter)    9    1.987
> org.apache.felix.framework.Felix.getServiceReferences(BundleImpl, String, 
> String, boolean)    9    1.987
> org.apache.felix.framework.Felix.getAllowedServiceReferences(BundleImpl, 
> String, String, boolean)    9    1.987
> org.apache.felix.framework.BundleContextImpl.getServiceReferences(String, 
> String)    9    1.987
> org.apache.camel.core.osgi.OsgiServiceRegistry.lookupByName(String) 9    1.987
> org.apache.camel.impl.CompositeRegistry.lookupByName(String)    9 1.987
> org.apache.camel.impl.PropertyPlaceholderDelegateRegistry.lookupByName(String)
>  9    1.987
> org.apache.camel.component.bean.RegistryBean.lookupBean()    9 1.987
> org.apache.camel.component.bean.RegistryBean.getBean()    9    1.987
> org.apache.camel.component.bean.AbstractBeanProcessor.process(Exchange, 
> AsyncCallback)    9    1.987
> org.apache.camel.component.bean.BeanProcessor.process(Exchange, 
> AsyncCallback)    9    1.987
> org.apache.camel.component.bean.BeanProducer.process(Exchange, AsyncCallback) 
>    9    1.987
> org.apache.camel.processor.SendProcessor.process(Exchange, AsyncCallback)    
> 9    1.987
> org.apache.camel.processor.RedeliveryErrorHandler.process(Exchange, 
> AsyncCallback)    9    1.987
> org.apache.camel.processor.CamelInternalProcessor.process(Exchange, 
> AsyncCallback)    9    1.987
> org.apache.camel.processor.CamelInternalProcessor.process(Exchange, 
> AsyncCallback)    9    1.987
> org.apache.camel.processor.DelegateAsyncProcessor.process(Exchange) 9    1.987
> org.apache.camel.http.common.CamelServlet.doService(HttpServletRequest, 
> HttpServletResponse)    9    1.987
>
> - Martin



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Reply via email to