Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smooth Cache Updates for Access Token Providers #59

Open
Michael-A-McMahon opened this issue Feb 7, 2024 · 0 comments
Open

Smooth Cache Updates for Access Token Providers #59

Michael-A-McMahon opened this issue Feb 7, 2024 · 0 comments
Assignees

Comments

@Michael-A-McMahon
Copy link
Member

The OCI and Azure access token providers currently use the standard CachedResourceFactory to cache tokens. If a thread requests a token from this cache, and the token has expired, then the factory will block the thread while it requests a new token.

The Oracle JDBC Driver implements a cache for JWTs:
https://docs.oracle.com/en/database/oracle/oracle-database/23/jajdb/oracle/jdbc/AccessToken.html#createJsonWebTokenCache(java.util.function.Supplier)
This cache is designed for "smooth" updates when a token expires. Like the CachedResourceFactory, this cache can also block threads; It will do so if the cached token is expiring within 30 seconds. However, this cache uses a background thread to begin requesting a new token at one minute before the current token expires. If the request completes within 30 seconds (which is almost always the case), then threads will not become blocked.

Use of Oracle JDBC's cache by OCI and Azure access token providers can benefit users. This cache can reduce latency when creating JDBC connections: A thread which opens a connection would not have to wait for CachedResourceFactory to complete a request for a new token.

This issue is opened for discussion of this enhancement and to track development work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants