Interface OracleConfigurationCachableProvider

  • All Superinterfaces:
    OracleConfigurationProvider

    public interface OracleConfigurationCachableProvider
    extends OracleConfigurationProvider

    The Cachable interface provides methods for caching objects. It extends the OracleConfigurationProvider interface, inheriting its behaviors.

    If any external provider requires caching, consider using OracleConfigurationCachableProvider interface instead of OracleConfigurationProvider. Utilizing OracleConfigurationCachableProvider lets the driver control when the cache entry should be purged. For example, the driver calls getCache() to get the cache instance and then OracleConfigurationCache.remove(String) to remove the cache entry when an "ORA-1017 Invalid Username/Password" error occurs.

    The driver provides OracleConfigurationCache, which is a thread-safe LRU cache that can be used to store the configuration from the remote location. The built-in providers that implement OracleConfigurationCachableProvider interface ( OracleConfigurationFileProvider, OracleConfigurationHttpsProvider and the providers that extend OracleConfigurationParsableProvider) use OracleConfigurationCache to cache configuration.

    The state of a cache entry can be "valid", "softly expired" or "hardly expired". A valid cache entry becomes softly expired after its config_time_to_live value expires, and can still be used for additional 30 minutes until it becomes hardly expired. During these 30 minutes, the cache attempts to refresh the configuration by reaching out to the remote location where the configuration stores. An entry becomes valid again once it is refreshed. Otherwise, it is considered as hardly expired if the remote location is not reachable.

    The config_time_to_live value is 86400 in seconds (24 hours) by default and it can be configured by specifying the "config_time_to_live" field in the configuration. Here is an example of the configuration which has a config_time_to_live value of 10 seconds in JSON format:

      {
        "connect_descriptor": "(description=(address_list=(address=(protocol=tcp)
            (host=myhost)(port=5521)))(connect_data=(service_name=myservice)))",
        "user": "scott",
        "password": {
          "type": "base64",
          "value": "dGlnZXI="
        },
        "wallet_location": {
          "type": "base64",
          "value": "bXl3YWxsZXRiaW5hcnlmaWxlCg=="
        },
        "jdbc": {
          "autoCommit": "true"
        },
        "config_time_to_live": 10
      }
      

    • Method Detail

      • getCache

        oracle.jdbc.util.OracleConfigurationCache getCache()
        Retrieve the cache as configured and instantiated by implementations of the OracleConfigurationCachableProvider interface. For cache implementations, please refer to OracleConfigurationJsonFileProvider and OracleConfigurationJsonHttpsProvider.
        Returns:
        OracleConfigurationCache configured by implementing classes.