Interface UpdatableCredential<T>

Type Parameters:
T - the type of the credential (typically String for 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:

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    setCredential(String username, T credential)
    Updates the credentials used by this component.
  • Method Details

    • setCredential

      void setCredential(String username, T credential)
      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 connections
      credential - the new credential (password) to use for connections