-
- All Implemented Interfaces:
public final class KotlinDataLoaderRegistry extends DataLoaderRegistryCustom DataLoaderRegistry decorator that access the CacheMap of each registered DataLoader in order to keep track of the onDispatchFutures when dispatchAll is invoked, that way we can know if all dependants of the CompletableFutures were executed.
-
-
Field Summary
Fields Modifier and Type Field Description private final Map<String, DataLoader<?, ?>>dataLoaders
-
Constructor Summary
Constructors Constructor Description KotlinDataLoaderRegistry(DataLoaderRegistry registry)
-
Method Summary
Modifier and Type Method Description DataLoaderRegistryregister(String key, DataLoader<?, ?> dataLoader)<K extends Any, V extends Any> DataLoader<K, V>computeIfAbsent(String key, Function<String, DataLoader<?, ?>> mappingFunction)DataLoaderRegistrycombine(DataLoaderRegistry registry)List<DataLoader<?, ?>>getDataLoaders()Map<String, DataLoader<?, ?>>getDataLoadersMap()DataLoaderRegistryunregister(String key)<K extends Any, V extends Any> DataLoader<K, V>getDataLoader(String key)Set<String>getKeys()IntegerdispatchAllWithCount()IntegerdispatchDepth()StatisticsgetStatistics()final List<CompletableFuture<?>>getOnDispatchFutures()will return a list of futures that represents the state of the CompletableFutures from each DataLoader cacheMap when dispatchAll was invoked. final List<CompletableFuture<?>>getCurrentFutures()will return a list of futures that represents the current state of the CompletableFutures from each DataLoader. UnitdispatchAll()This will invoke DataLoader.dispatch on each of the registered DataLoaders, it will start to keep track of the CompletableFutures of each DataLoader by adding them to onDispatchFutures final BooleanonDispatchFuturesHandled()Will signal when all dependants of all onDispatchFutures were invoked, onDispatchFutures is the list of all CompletableFutures that will complete because the dispatchAll method was invoked final BooleandataLoadersInvokedOnDispatch()Will signal if more dataLoaders where invoked during the dispatchAll invocation -
-
Method Detail
-
computeIfAbsent
<K extends Any, V extends Any> DataLoader<K, V> computeIfAbsent(String key, Function<String, DataLoader<?, ?>> mappingFunction)
-
combine
DataLoaderRegistry combine(DataLoaderRegistry registry)
-
getDataLoaders
List<DataLoader<?, ?>> getDataLoaders()
-
getDataLoadersMap
Map<String, DataLoader<?, ?>> getDataLoadersMap()
-
unregister
DataLoaderRegistry unregister(String key)
-
dispatchAllWithCount
Integer dispatchAllWithCount()
-
dispatchDepth
Integer dispatchDepth()
-
getStatistics
Statistics getStatistics()
-
getOnDispatchFutures
final List<CompletableFuture<?>> getOnDispatchFutures()
will return a list of futures that represents the state of the CompletableFutures from each DataLoader cacheMap when dispatchAll was invoked.
-
getCurrentFutures
final List<CompletableFuture<?>> getCurrentFutures()
will return a list of futures that represents the current state of the CompletableFutures from each DataLoader.
-
dispatchAll
Unit dispatchAll()
This will invoke DataLoader.dispatch on each of the registered DataLoaders, it will start to keep track of the CompletableFutures of each DataLoader by adding them to onDispatchFutures
-
onDispatchFuturesHandled
final Boolean onDispatchFuturesHandled()
Will signal when all dependants of all onDispatchFutures were invoked, onDispatchFutures is the list of all CompletableFutures that will complete because the dispatchAll method was invoked
-
dataLoadersInvokedOnDispatch
final Boolean dataLoadersInvokedOnDispatch()
Will signal if more dataLoaders where invoked during the dispatchAll invocation
-
-
-
-