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



##########
File path: 
gateway-server/src/main/java/org/apache/knox/gateway/services/factory/TokenStateServiceFactory.java
##########
@@ -51,8 +55,15 @@ protected Service createService(GatewayServices 
gatewayServices, ServiceType ser
       } else if (matchesImplementation(implementation, 
ZookeeperTokenStateService.class)) {
         service = new ZookeeperTokenStateService(gatewayServices);
       } else if (matchesImplementation(implementation, 
JDBCTokenStateService.class)) {
-        service = new JDBCTokenStateService();
-       ((JDBCTokenStateService) 
service).setAliasService(getAliasService(gatewayServices));
+        try {
+          service = new JDBCTokenStateService();
+          ((JDBCTokenStateService) 
service).setAliasService(getAliasService(gatewayServices));
+          service.init(gatewayConfig, options);

Review comment:
       In `org.apache.knox.gateway.services.GatewayServiceFactory` the 
`init(...)` method is called on the particular token state service 
implementation, therefore `JDBCTokenStateService.init(...)` is called at least 
twice. This is the reason I added state in that class to make sure 
initialization logic is invoked only once.




-- 
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