LoaderHelper (Apache Geode 1.6.0)
Date: 2018-04-23

org.apache.geode.cache

## Interface LoaderHelper<K,V>

-     public interface LoaderHelper<K,V>

  Provides a set of APIs to help the implementation of the `CacheLoader` load method. An instance of `LoaderHelper` is only valid within the `load` method.
  Since:
    GemFire 2.0
  See Also:
    `load`

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.Object` | `getArgument()` Return the argument object for the load method that was passed in from application code.
    `K` | `getKey()` Returns the key for the value being loaded.
    `Region<K,V>` | `getRegion()` Returns the region to which the entry belongs.
    `V` | `netSearch(boolean doNetLoad)` Searches other caches for the value to be loaded.

- - ### Method Detail

    - #### netSearch

          V netSearch(boolean doNetLoad)
               throws CacheLoaderException,
                      TimeoutException

      Searches other caches for the value to be loaded. If the cache is part of a distributed caching system, `netSearch` will try to locate the requested value in any other cache within the system. If the search is successful, a reference to a local copy of the value is returned. If there is no value for this entry present in the system, and doNetLoad is true, GemFire looks for and invokes `CacheLoaders` in other nodes in the system. The net load will invoke one loader at a time until a loader either returns a non-null value or throws an exception. If the object is not found, `null` is returned.
      Parameters:
        `doNetLoad` - if true, and there is no valid value found for this entry in the system, then look for and invoke loaders on other nodes
      Returns:
        the requested value or null if not found
      Throws:
        `TimeoutException` - if the netSearch times out before getting a response from another cache
        `CacheLoaderException` - If `netSearch` is attempted on a local region.

    - #### getKey

          K getKey()

      Returns the key for the value being loaded.
      Returns:
        the name Object for the object being loaded
      See Also:
        `load`

    - #### getRegion

          Region<K,V> getRegion()

      Returns the region to which the entry belongs.
      Returns:
        the name of the region for the object being loaded
      See Also:
        `load`

    - #### getArgument

          java.lang.Object getArgument()

      Return the argument object for the load method that was passed in from application code. This object is passed in as aLoaderArgument in `get`.
      Returns:
        the argument or null if one was not supplied