You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Luca Burgazzoli (Jira)" <ji...@apache.org> on 2021/02/03 09:51:00 UTC

[jira] [Created] (CAMEL-16136) core: replace BaseServiceResolver with a static method

Luca Burgazzoli created CAMEL-16136:
---------------------------------------

             Summary: core: replace BaseServiceResolver with a static method
                 Key: CAMEL-16136
                 URL: https://issues.apache.org/jira/browse/CAMEL-16136
             Project: Camel
          Issue Type: Improvement
          Components: camel-core-engine
            Reporter: Luca Burgazzoli
            Assignee: Luca Burgazzoli
             Fix For: 3.8.0


I noticed that in SimpleCamelContext and other few pieces we use the following patter:

{code:Java}
        BaseServiceResolver<DeferServiceFactory> resolver = new BaseServiceResolver<>(
                DeferServiceFactory.FACTORY,
                DeferServiceFactory.class,
               getBootstrapFactoryFinder());

        Optional<DeferServiceFactory> result = resolver.resolve(getCamelContextReference());
        if (result.isPresent()) {
            return result.get();
        } else {
            throw new IllegalArgumentException("...");
        }
{code}

I wonder if we really need to allocate a BaseServiceResolver as in fact the instance is never reused and I do not see any location where the class is extended so maybe we can either replace it with a static method or we can add a similar functionality to ExtendedCamelContext.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)