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

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

                Author: ASF GitHub Bot
            Created on: 31/Aug/20 09:01
            Start Date: 31/Aug/20 09:01
    Worklog Time Spent: 10m 
      Work Description: smolnar82 commented on a change in pull request #365:
URL: https://github.com/apache/knox/pull/365#discussion_r479993879



##########
File path: 
gateway-server/src/main/java/org/apache/knox/gateway/services/token/impl/DefaultTokenStateService.java
##########
@@ -154,17 +177,16 @@ public long getTokenExpiration(final String tokenId) 
throws UnknownTokenExceptio
 
   @Override
   public long getTokenExpiration(String tokenId, boolean validate) throws 
UnknownTokenException {
-    long expiration;
-
     if (validate) {
       validateToken(tokenId);
     }
 
+    long expiration = -1;
     synchronized (tokenExpirations) {
-      if (!tokenExpirations.containsKey(tokenId)) {
-        throw new UnknownTokenException(tokenId);
-      }
-      expiration = tokenExpirations.get(tokenId);
+      expiration = tokenExpirations.getOrDefault(tokenId, -1L);
+    }
+    if (expiration == -1) {

Review comment:
       There is a slight difference: we can save one iteration when checking 
`tokenExpirations`
   `containsKey + get` vs. `getOrDefault`.
   But you are right, there is no more difference between the two versions.




----------------------------------------------------------------
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: 476455)
    Time Spent: 1h 20m  (was: 1h 10m)

> Develop a performance-test framework to test token state service
> ----------------------------------------------------------------
>
>                 Key: KNOX-2402
>                 URL: https://issues.apache.org/jira/browse/KNOX-2402
>             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: 1h 20m
>  Remaining Estimate: 0h
>
> The general goal is to have an extendable performance test framework that 
> will drive the Knox Gateway configured by different use cases.
> Some initial requirements of this framework:
> - easy to extend with new use-cases
> - has the ability to execute long-running jobs
> - has the ability to connect to it and query different metrics
> - generate meaningful and easy-to-read reports of those metrics automatically 
> (in configurable time periods) 
> In the first phase, the task is to conduct and codify performance testing for 
> scalability and performance benchmarking with concurrent clients, with 
> long-running jobs that stress the backend of the token state server store:
> - use different token state server implementations
> - turn on/off the token state service mechanism
> - use concurrent clients who dealing with tokens (make sure they actually use 
> the tokens and periodically renew them)



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

Reply via email to