Class CachingSupplier<REQ,REP>

java.lang.Object
org.apache.maven.impl.cache.CachingSupplier<REQ,REP>
Type Parameters:
REQ - The request type
REP - The response type
All Implemented Interfaces:
Function<REQ,REP>

public class CachingSupplier<REQ,REP> extends Object implements Function<REQ,REP>
A caching supplier wrapper that caches results and exceptions from the underlying supplier. Used internally to cache expensive computations in the session.
  • Field Details

  • Constructor Details

    • CachingSupplier

      public CachingSupplier(Function<REQ,REP> supplier)
  • Method Details

    • getValue

      public Object getValue()
    • complete

      public void complete(Object result)
      Directly sets the cached value without invoking the supplier, then notifies any threads blocked in apply(Object) waiting for the result.

      This is used by AbstractRequestCache.requests(List, Function) to set batch-resolved results on CachingSupplier instances. Concurrent callers blocked in apply() will be woken up and see this value instead of invoking the supplier redundantly.

      Parameters:
      result - the result to cache (may be a normal result or an CachingSupplier.AltRes for errors)
    • apply

      public REP apply(REQ req)
      Specified by:
      apply in interface Function<REQ,REP>