smolnar82 commented on a change in pull request #361:
URL: https://github.com/apache/knox/pull/361#discussion_r454998712



##########
File path: 
gateway-server/src/main/java/org/apache/knox/gateway/services/factory/AbstractServiceFactory.java
##########
@@ -47,22 +52,38 @@ public Service create(GatewayServices gatewayServices, 
ServiceType serviceType,
   @Override
   public Service create(GatewayServices gatewayServices, ServiceType 
serviceType, GatewayConfig gatewayConfig, Map<String, String> options, String 
implementation)
       throws ServiceLifecycleException {
-    Service service = null;
-    if (getServiceType() == serviceType) {
-      service = createService(gatewayServices, serviceType, gatewayConfig, 
options, implementation);
-      if (service == null && StringUtils.isNotBlank(implementation)) {
-        // no known service implementation created, try to create the custom 
one
-        try {
-          service = 
Service.class.cast(Class.forName(implementation).newInstance());
-          logServiceUsage(implementation, serviceType);
-        } catch (InstantiationException | IllegalAccessException | 
ClassNotFoundException e) {
-          throw new ServiceLifecycleException("Errror while instantiating " + 
serviceType.getShortName() + " service implementation " + implementation, e);
+    Service service = fetchFromCache(serviceType, implementation);
+    if (service == null) {
+      if (getServiceType() == serviceType) {
+        service = createService(gatewayServices, serviceType, gatewayConfig, 
options, implementation);
+        if (service == null && StringUtils.isNotBlank(implementation)) {
+          // no known service implementation created, try to create the custom 
one
+          try {
+            service = 
Service.class.cast(Class.forName(implementation).newInstance());
+            logServiceUsage(implementation, serviceType);
+          } catch (InstantiationException | IllegalAccessException | 
ClassNotFoundException e) {
+            throw new ServiceLifecycleException("Errror while instantiating " 
+ serviceType.getShortName() + " service implementation " + implementation, e);

Review comment:
       Fixed.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to