Details
-
Improvement
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
None
-
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.