Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-16136

core: replace BaseServiceResolver with a static method

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.8.0
    • Component/s: camel-core-engine
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

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

              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("...");
              }
      

      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.

        Attachments

          Activity

            People

            • Assignee:
              lburgazzoli Luca Burgazzoli
              Reporter:
              lburgazzoli Luca Burgazzoli
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: