[ 
https://issues.apache.org/jira/browse/KNOX-2399?focusedWorklogId=458679&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-458679
 ]

ASF GitHub Bot logged work on KNOX-2399:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 14/Jul/20 14:37
            Start Date: 14/Jul/20 14:37
    Worklog Time Spent: 10m 
      Work Description: pzampino commented on a change in pull request #361:
URL: https://github.com/apache/knox/pull/361#discussion_r454404824



##########
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());

Review comment:
       I don't believe there is any functional difference between the two. The 
_cast_ method didn't exist until generics were added to Java.




----------------------------------------------------------------
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:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 458679)
    Time Spent: 2h 20m  (was: 2h 10m)

> Implement ZK token state service
> --------------------------------
>
>                 Key: KNOX-2399
>                 URL: https://issues.apache.org/jira/browse/KNOX-2399
>             Project: Apache Knox
>          Issue Type: Task
>    Affects Versions: 1.4.0
>            Reporter: Sandor Molnar
>            Assignee: Sandor Molnar
>            Priority: Major
>             Fix For: 1.5.0
>
>          Time Spent: 2h 20m
>  Remaining Estimate: 0h
>
> Implement a new {{TokenStateService}} implementation which stores/fetches 
> token related metadata in Zookeeper. The new service should be configurable 
> to directly go to Zookeeper or use some local cache (e.g. a local alias 
> service).



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

Reply via email to