Search in sources :

Example 1 with AsyncLoadingCache

use of com.github.benmanes.caffeine.cache.AsyncLoadingCache in project pulsar by yahoo.

the class NamespaceServiceTest method splitBundles.

@SuppressWarnings("unchecked")
private Pair<NamespaceBundles, List<NamespaceBundle>> splitBundles(NamespaceBundleFactory utilityFactory, NamespaceName nsname, NamespaceBundles bundles, NamespaceBundle targetBundle) throws Exception {
    Field bCacheField = NamespaceBundleFactory.class.getDeclaredField("bundlesCache");
    bCacheField.setAccessible(true);
    ((AsyncLoadingCache<NamespaceName, NamespaceBundles>) bCacheField.get(utilityFactory)).put(nsname, CompletableFuture.completedFuture(bundles));
    return utilityFactory.splitBundles(targetBundle, 2);
}
Also used : Field(java.lang.reflect.Field) AsyncLoadingCache(com.github.benmanes.caffeine.cache.AsyncLoadingCache)

Example 2 with AsyncLoadingCache

use of com.github.benmanes.caffeine.cache.AsyncLoadingCache in project pulsar by yahoo.

the class NamespaceBundlesTest method splitBundlesUtilFactory.

@SuppressWarnings("unchecked")
private Pair<NamespaceBundles, List<NamespaceBundle>> splitBundlesUtilFactory(NamespaceBundleFactory utilityFactory, NamespaceName nsname, NamespaceBundles bundles, NamespaceBundle targetBundle, int numBundles) throws Exception {
    Field bCacheField = NamespaceBundleFactory.class.getDeclaredField("bundlesCache");
    bCacheField.setAccessible(true);
    ((AsyncLoadingCache<NamespaceName, NamespaceBundles>) bCacheField.get(utilityFactory)).put(nsname, CompletableFuture.completedFuture(bundles));
    return utilityFactory.splitBundles(targetBundle, numBundles);
}
Also used : Field(java.lang.reflect.Field) AsyncLoadingCache(com.github.benmanes.caffeine.cache.AsyncLoadingCache)

Example 3 with AsyncLoadingCache

use of com.github.benmanes.caffeine.cache.AsyncLoadingCache in project incubator-pulsar by apache.

the class NamespaceBundlesTest method splitBundlesUtilFactory.

@SuppressWarnings("unchecked")
private Pair<NamespaceBundles, List<NamespaceBundle>> splitBundlesUtilFactory(NamespaceBundleFactory utilityFactory, NamespaceName nsname, NamespaceBundles bundles, NamespaceBundle targetBundle, int numBundles) throws Exception {
    Field bCacheField = NamespaceBundleFactory.class.getDeclaredField("bundlesCache");
    bCacheField.setAccessible(true);
    ((AsyncLoadingCache<NamespaceName, NamespaceBundles>) bCacheField.get(utilityFactory)).put(nsname, CompletableFuture.completedFuture(bundles));
    return utilityFactory.splitBundles(targetBundle, numBundles);
}
Also used : Field(java.lang.reflect.Field) AsyncLoadingCache(com.github.benmanes.caffeine.cache.AsyncLoadingCache)

Example 4 with AsyncLoadingCache

use of com.github.benmanes.caffeine.cache.AsyncLoadingCache in project incubator-pulsar by apache.

the class NamespaceServiceTest method splitBundles.

@SuppressWarnings("unchecked")
private Pair<NamespaceBundles, List<NamespaceBundle>> splitBundles(NamespaceBundleFactory utilityFactory, NamespaceName nsname, NamespaceBundles bundles, NamespaceBundle targetBundle) throws Exception {
    Field bCacheField = NamespaceBundleFactory.class.getDeclaredField("bundlesCache");
    bCacheField.setAccessible(true);
    ((AsyncLoadingCache<NamespaceName, NamespaceBundles>) bCacheField.get(utilityFactory)).put(nsname, CompletableFuture.completedFuture(bundles));
    return utilityFactory.splitBundles(targetBundle, 2);
}
Also used : Field(java.lang.reflect.Field) AsyncLoadingCache(com.github.benmanes.caffeine.cache.AsyncLoadingCache)

Aggregations

AsyncLoadingCache (com.github.benmanes.caffeine.cache.AsyncLoadingCache)4 Field (java.lang.reflect.Field)4