Package 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:
-
Method Summary
Modifier and TypeMethodDescriptionReturn the argument object for the load method that was passed in from application code.getKey()Returns the key for the value being loaded.Returns the region to which the entry belongs.netSearch(boolean doNetLoad) Searches other caches for the value to be loaded.
-
Method Details
-
netSearch
Searches other caches for the value to be loaded. If the cache is part of a distributed caching system,netSearchwill 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 invokesCacheLoadersin 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,nullis 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 cacheCacheLoaderException- IfnetSearchis 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:
-
getRegion
Returns the region to which the entry belongs.- Returns:
- the name of the region for the object being loaded
- See Also:
-
getArgument
Object getArgument()Return the argument object for the load method that was passed in from application code. This object is passed in as aLoaderArgument inget.- Returns:
- the argument or null if one was not supplied
-