Interface BatchLoaderWithContext<K,​V>


  • @PublicSpi
    public interface BatchLoaderWithContext<K,​V>
    This form of BatchLoader is given a BatchLoaderEnvironment object that encapsulates the calling context. A typical use case is passing in security credentials or database connection details say. See BatchLoader for more details on the design invariants that you must implement in order to use this interface.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.util.concurrent.CompletionStage<java.util.List<V>> load​(java.util.List<K> keys, BatchLoaderEnvironment environment)
      Called to batch load the provided keys and return a promise to a list of values.
    • Method Detail

      • load

        java.util.concurrent.CompletionStage<java.util.List<V>> load​(java.util.List<K> keys,
                                                                     BatchLoaderEnvironment environment)
        Called to batch load the provided keys and return a promise to a list of values. This default version can be given an environment object to that maybe be useful during the call. A typical use case is passing in security credentials or database details for example.
        Parameters:
        keys - the collection of keys to load
        environment - an environment object that can help with the call
        Returns:
        a promise of the values for those keys