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

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

                Author: ASF GitHub Bot
            Created on: 02/May/21 18:26
            Start Date: 02/May/21 18:26
    Worklog Time Spent: 10m 
      Work Description: 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]


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

    Worklog Id:     (was: 592025)
    Time Spent: 40m  (was: 0.5h)

> Fallback to AliasBasedTokenStateService in case of DB errors
> ------------------------------------------------------------
>
>                 Key: KNOX-2597
>                 URL: https://issues.apache.org/jira/browse/KNOX-2597
>             Project: Apache Knox
>          Issue Type: Task
>    Affects Versions: 1.6.0
>            Reporter: Sandor Molnar
>            Assignee: Sandor Molnar
>            Priority: Major
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> We recently added support to pure JDBC-based token state management. It'd be 
> great to make deployments smooth with the following safety net: if there is 
> (are) any issue(s) with the configured DB connection, the Knox Gateway should 
> start using the {{AliasBasedTokenStateService}} instead of fail-fast. 
> Additionally, the {{tokengen}} UI should indicate the fact if the underlying 
> token back-end is the one the user configured.



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

Reply via email to