Interface UpdatableCredential<T>
- Type Parameters:
T- the type of the credential (typicallyStringfor passwords)
- All Known Implementing Classes:
HikariCredentialsUpdater,UcpCredentialsUpdater
public interface UpdatableCredential<T>
Interface for components that need to receive updated credentials when they change.
This interface enables a publish-subscribe pattern for credential rotation. When
credentials are rotated (e.g., by reading new values from Kubernetes-mounted secret files),
all registered UpdatableCredential implementations are notified with the new values.
Implementations typically wrap connection pools and handle the pool-specific logic for updating credentials and refreshing connections. For example:
HikariCredentialsUpdater- Updates HikariCP credentials and soft-evicts connectionsUcpCredentialsUpdater- Updates Oracle UCP credentials and refreshes the pool
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidsetCredential(String username, T credential) Updates the credentials used by this component.
-
Method Details
-
setCredential
Updates the credentials used by this component.Implementations should atomically update their stored credentials and trigger any necessary pool refresh operations. This method may be called from a scheduled background thread, so implementations must be thread-safe.
- Parameters:
username- the new username to use for connectionscredential- the new credential (password) to use for connections
-