smolnar82 opened a new pull request, #1525:
URL: https://github.com/apache/knox/pull/1525

   [KNOX-3591](https://issues.apache.org/jira/browse/KNOX-3591) - KnoxIDF 
resources are instantiated per request because @Singleton is not inherited
   
   ## What changes were proposed in this pull request?
   
   `jakarta.inject.Singleton` is not `@Inherited`, so the KnoxIDF subclasses of 
the singleton knoxtoken resources were created per request and ran `init()` on 
every call. On the token endpoint, every request did an uncached gateway 
keystore load under a file lock (`setupPublicCertPEM`) and wrote duplicate 
`setupTokenStateService` log lines.
   
   This PR adds `@Singleton` to all KnoxIDF resources except 
`RegistrationResource`. That one keeps per-request state (`redirectUris`, 
`allowedScopes`) on the instance, so it stays `@RequestScoped`.
   
   ## How was this patch tested?
   
   - `mvn -pl gateway-service-knoxidf test`: all tests pass.
   - Ran a local RFC 8693 token exchange load test (20 threads, delegation 
depth 3) and checked that `init()` runs once per resource and the per-request 
log lines are gone.
   
   ## Integration Tests
   
   No new tests. The behaviour is unchanged; the existing KnoxIDF integration 
tests exercise these endpoints.
   


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

To unsubscribe, e-mail: [email protected]

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

Reply via email to