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

core: replace BaseServiceResolver with a static method

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 3.8.0
    • came-core
    • None
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: