Java 类org.springframework.boot.actuate.cache.CacheStatisticsProvider 实例源码

项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:CachePublicMetrics.java   
@SuppressWarnings({ "rawtypes", "unchecked" })
private CacheStatistics getCacheStatistics(Cache cache, CacheManager cacheManager) {
    if (this.statisticsProviders != null) {
        for (CacheStatisticsProvider provider : this.statisticsProviders) {
            Class<?> cacheType = ResolvableType
                    .forClass(CacheStatisticsProvider.class, provider.getClass())
                    .resolveGeneric();
            if (cacheType.isInstance(cache)) {
                CacheStatistics statistics = provider.getCacheStatistics(cacheManager,
                        cache);
                if (statistics != null) {
                    return statistics;
                }
            }
        }
    }
    return null;
}
项目:spring-boot-concourse    文件:CachePublicMetrics.java   
@SuppressWarnings({ "rawtypes", "unchecked" })
private CacheStatistics getCacheStatistics(Cache cache, CacheManager cacheManager) {
    if (this.statisticsProviders != null) {
        for (CacheStatisticsProvider provider : this.statisticsProviders) {
            Class<?> cacheType = ResolvableType
                    .forClass(CacheStatisticsProvider.class, provider.getClass())
                    .resolveGeneric();
            if (cacheType.isInstance(cache)) {
                CacheStatistics statistics = provider.getCacheStatistics(cacheManager,
                        cache);
                if (statistics != null) {
                    return statistics;
                }
            }
        }
    }
    return null;
}
项目:contestparser    文件:CachePublicMetrics.java   
@SuppressWarnings({ "rawtypes", "unchecked" })
private CacheStatistics getCacheStatistics(Cache cache, CacheManager cacheManager) {
    if (this.statisticsProviders != null) {
        for (CacheStatisticsProvider provider : this.statisticsProviders) {
            Class<?> cacheType = ResolvableType
                    .forClass(CacheStatisticsProvider.class, provider.getClass())
                    .resolveGeneric();
            if (cacheType.isInstance(cache)) {
                CacheStatistics statistics = provider.getCacheStatistics(cacheManager,
                        cache);
                if (statistics != null) {
                    return statistics;
                }
            }
        }
    }
    return null;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:CacheStatisticsAutoConfiguration.java   
@Bean
public CacheStatisticsProvider<Cache> noOpCacheStatisticsProvider() {
    return new CacheStatisticsProvider<Cache>() {
        @Override
        public CacheStatistics getCacheStatistics(CacheManager cacheManager,
                Cache cache) {
            if (cacheManager instanceof NoOpCacheManager) {
                return NO_OP_STATS;
            }
            return null;
        }
    };
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:CacheStatisticsAutoConfigurationTests.java   
@Test
public void basicJCacheCacheStatistics() {
    load(JCacheCacheConfig.class);
    CacheStatisticsProvider provider = this.context
            .getBean("jCacheCacheStatisticsProvider", CacheStatisticsProvider.class);
    doTestCoreStatistics(provider, false);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:CacheStatisticsAutoConfigurationTests.java   
@Test
public void basicEhCacheCacheStatistics() {
    load(EhCacheConfig.class);
    CacheStatisticsProvider provider = this.context
            .getBean("ehCacheCacheStatisticsProvider", CacheStatisticsProvider.class);
    doTestCoreStatistics(provider, true);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:CacheStatisticsAutoConfigurationTests.java   
@Test
public void basicHazelcastCacheStatistics() {
    load(HazelcastConfig.class);
    CacheStatisticsProvider provider = this.context.getBean(
            "hazelcastCacheStatisticsProvider", CacheStatisticsProvider.class);
    doTestCoreStatistics(provider, true);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:CacheStatisticsAutoConfigurationTests.java   
@Test
public void basicInfinispanCacheStatistics() {
    load(InfinispanConfig.class);
    CacheStatisticsProvider provider = this.context.getBean(
            "infinispanCacheStatisticsProvider", CacheStatisticsProvider.class);
    doTestCoreStatistics(provider, true);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:CacheStatisticsAutoConfigurationTests.java   
@Test
public void basicGuavaCacheStatistics() {
    load(GuavaConfig.class);
    CacheStatisticsProvider provider = this.context
            .getBean("guavaCacheStatisticsProvider", CacheStatisticsProvider.class);
    doTestCoreStatistics(provider, true);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:CacheStatisticsAutoConfigurationTests.java   
@Test
public void baseCaffeineCacheStatistics() {
    load(CaffeineCacheConfig.class);
    CacheStatisticsProvider provider = this.context.getBean(
            "caffeineCacheStatisticsProvider", CacheStatisticsProvider.class);
    doTestCoreStatistics(provider, true);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:CacheStatisticsAutoConfigurationTests.java   
@Test
public void concurrentMapCacheStatistics() {
    load(ConcurrentMapConfig.class);
    CacheStatisticsProvider provider = this.context.getBean(
            "concurrentMapCacheStatisticsProvider", CacheStatisticsProvider.class);
    Cache books = getCache("books");
    CacheStatistics cacheStatistics = provider.getCacheStatistics(this.cacheManager,
            books);
    assertCoreStatistics(cacheStatistics, 0L, null, null);
    getOrCreate(books, "a", "b", "b", "a", "a");
    CacheStatistics updatedCacheStatistics = provider
            .getCacheStatistics(this.cacheManager, books);
    assertCoreStatistics(updatedCacheStatistics, 2L, null, null);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:CacheStatisticsAutoConfigurationTests.java   
@Test
public void noOpCacheStatistics() {
    load(NoOpCacheConfig.class);
    CacheStatisticsProvider provider = this.context
            .getBean("noOpCacheStatisticsProvider", CacheStatisticsProvider.class);
    Cache books = getCache("books");
    CacheStatistics cacheStatistics = provider.getCacheStatistics(this.cacheManager,
            books);
    assertCoreStatistics(cacheStatistics, null, null, null);
    getOrCreate(books, "a", "b", "b", "a", "a");
    CacheStatistics updatedCacheStatistics = provider
            .getCacheStatistics(this.cacheManager, books);
    assertCoreStatistics(updatedCacheStatistics, null, null, null);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:CacheStatisticsAutoConfigurationTests.java   
private void doTestCoreStatistics(CacheStatisticsProvider provider,
        boolean supportSize) {
    Cache books = getCache("books");
    CacheStatistics cacheStatistics = provider.getCacheStatistics(this.cacheManager,
            books);
    assertCoreStatistics(cacheStatistics, (supportSize ? 0L : null), null, null);
    getOrCreate(books, "a", "b", "b", "a", "a", "a");
    CacheStatistics updatedCacheStatistics = provider
            .getCacheStatistics(this.cacheManager, books);
    assertCoreStatistics(updatedCacheStatistics, (supportSize ? 2L : null), 0.66D,
            0.33D);
}
项目:spring-boot-concourse    文件:CacheStatisticsAutoConfiguration.java   
@Bean
public CacheStatisticsProvider<Cache> noOpCacheStatisticsProvider() {
    return new CacheStatisticsProvider<Cache>() {
        @Override
        public CacheStatistics getCacheStatistics(CacheManager cacheManager,
                Cache cache) {
            if (cacheManager instanceof NoOpCacheManager) {
                return NO_OP_STATS;
            }
            return null;
        }
    };
}
项目:spring-boot-concourse    文件:CacheStatisticsAutoConfigurationTests.java   
@Test
public void basicJCacheCacheStatistics() {
    load(JCacheCacheConfig.class);
    CacheStatisticsProvider provider = this.context
            .getBean("jCacheCacheStatisticsProvider", CacheStatisticsProvider.class);
    doTestCoreStatistics(provider, false);
}
项目:spring-boot-concourse    文件:CacheStatisticsAutoConfigurationTests.java   
@Test
public void basicEhCacheCacheStatistics() {
    load(EhCacheConfig.class);
    CacheStatisticsProvider provider = this.context
            .getBean("ehCacheCacheStatisticsProvider", CacheStatisticsProvider.class);
    doTestCoreStatistics(provider, true);
}
项目:spring-boot-concourse    文件:CacheStatisticsAutoConfigurationTests.java   
@Test
public void basicHazelcastCacheStatistics() {
    load(HazelcastConfig.class);
    CacheStatisticsProvider provider = this.context.getBean(
            "hazelcastCacheStatisticsProvider", CacheStatisticsProvider.class);
    doTestCoreStatistics(provider, true);
}
项目:spring-boot-concourse    文件:CacheStatisticsAutoConfigurationTests.java   
@Test
public void basicInfinispanCacheStatistics() {
    load(InfinispanConfig.class);
    CacheStatisticsProvider provider = this.context.getBean(
            "infinispanCacheStatisticsProvider", CacheStatisticsProvider.class);
    doTestCoreStatistics(provider, true);
}
项目:spring-boot-concourse    文件:CacheStatisticsAutoConfigurationTests.java   
@Test
public void basicGuavaCacheStatistics() {
    load(GuavaConfig.class);
    CacheStatisticsProvider provider = this.context
            .getBean("guavaCacheStatisticsProvider", CacheStatisticsProvider.class);
    doTestCoreStatistics(provider, true);
}
项目:spring-boot-concourse    文件:CacheStatisticsAutoConfigurationTests.java   
@Test
public void baseCaffeineCacheStatistics() {
    load(CaffeineCacheConfig.class);
    CacheStatisticsProvider provider = this.context.getBean(
            "caffeineCacheStatisticsProvider", CacheStatisticsProvider.class);
    doTestCoreStatistics(provider, true);
}
项目:spring-boot-concourse    文件:CacheStatisticsAutoConfigurationTests.java   
@Test
public void concurrentMapCacheStatistics() {
    load(ConcurrentMapConfig.class);
    CacheStatisticsProvider provider = this.context.getBean(
            "concurrentMapCacheStatisticsProvider", CacheStatisticsProvider.class);
    Cache books = getCache("books");
    CacheStatistics cacheStatistics = provider.getCacheStatistics(this.cacheManager,
            books);
    assertCoreStatistics(cacheStatistics, 0L, null, null);
    getOrCreate(books, "a", "b", "b", "a", "a");
    CacheStatistics updatedCacheStatistics = provider
            .getCacheStatistics(this.cacheManager, books);
    assertCoreStatistics(updatedCacheStatistics, 2L, null, null);
}
项目:spring-boot-concourse    文件:CacheStatisticsAutoConfigurationTests.java   
@Test
public void noOpCacheStatistics() {
    load(NoOpCacheConfig.class);
    CacheStatisticsProvider provider = this.context
            .getBean("noOpCacheStatisticsProvider", CacheStatisticsProvider.class);
    Cache books = getCache("books");
    CacheStatistics cacheStatistics = provider.getCacheStatistics(this.cacheManager,
            books);
    assertCoreStatistics(cacheStatistics, null, null, null);
    getOrCreate(books, "a", "b", "b", "a", "a");
    CacheStatistics updatedCacheStatistics = provider
            .getCacheStatistics(this.cacheManager, books);
    assertCoreStatistics(updatedCacheStatistics, null, null, null);
}
项目:spring-boot-concourse    文件:CacheStatisticsAutoConfigurationTests.java   
private void doTestCoreStatistics(CacheStatisticsProvider provider,
        boolean supportSize) {
    Cache books = getCache("books");
    CacheStatistics cacheStatistics = provider.getCacheStatistics(this.cacheManager,
            books);
    assertCoreStatistics(cacheStatistics, (supportSize ? 0L : null), null, null);
    getOrCreate(books, "a", "b", "b", "a", "a", "a");
    CacheStatistics updatedCacheStatistics = provider
            .getCacheStatistics(this.cacheManager, books);
    assertCoreStatistics(updatedCacheStatistics, (supportSize ? 2L : null), 0.66D,
            0.33D);
}
项目:contestparser    文件:CacheStatisticsAutoConfiguration.java   
@Bean
public CacheStatisticsProvider<Cache> noOpCacheStatisticsProvider() {
    return new CacheStatisticsProvider<Cache>() {
        @Override
        public CacheStatistics getCacheStatistics(CacheManager cacheManager,
                Cache cache) {
            if (cacheManager instanceof NoOpCacheManager) {
                return NO_OP_STATS;
            }
            return null;
        }
    };
}
项目:contestparser    文件:CacheStatisticsAutoConfigurationTests.java   
@Test
public void basicJCacheCacheStatistics() {
    load(JCacheCacheConfig.class);
    CacheStatisticsProvider provider = this.context
            .getBean("jCacheCacheStatisticsProvider", CacheStatisticsProvider.class);
    doTestCoreStatistics(provider, false);
}
项目:contestparser    文件:CacheStatisticsAutoConfigurationTests.java   
@Test
public void basicEhCacheCacheStatistics() {
    load(EhCacheConfig.class);
    CacheStatisticsProvider provider = this.context
            .getBean("ehCacheCacheStatisticsProvider", CacheStatisticsProvider.class);
    doTestCoreStatistics(provider, true);
}
项目:contestparser    文件:CacheStatisticsAutoConfigurationTests.java   
@Test
public void basicHazelcastCacheStatistics() {
    load(HazelcastConfig.class);
    CacheStatisticsProvider provider = this.context.getBean(
            "hazelcastCacheStatisticsProvider", CacheStatisticsProvider.class);
    doTestCoreStatistics(provider, true);
}
项目:contestparser    文件:CacheStatisticsAutoConfigurationTests.java   
@Test
public void basicInfinispanCacheStatistics() {
    load(InfinispanConfig.class);
    CacheStatisticsProvider provider = this.context.getBean(
            "infinispanCacheStatisticsProvider", CacheStatisticsProvider.class);
    doTestCoreStatistics(provider, true);
}
项目:contestparser    文件:CacheStatisticsAutoConfigurationTests.java   
@Test
public void basicGuavaCacheStatistics() {
    load(GuavaConfig.class);
    CacheStatisticsProvider provider = this.context
            .getBean("guavaCacheStatisticsProvider", CacheStatisticsProvider.class);
    doTestCoreStatistics(provider, true);
}
项目:contestparser    文件:CacheStatisticsAutoConfigurationTests.java   
@Test
public void concurrentMapCacheStatistics() {
    load(ConcurrentMapConfig.class);
    CacheStatisticsProvider provider = this.context.getBean(
            "concurrentMapCacheStatisticsProvider", CacheStatisticsProvider.class);
    Cache books = getCache("books");
    CacheStatistics cacheStatistics = provider.getCacheStatistics(this.cacheManager,
            books);
    assertCoreStatistics(cacheStatistics, 0L, null, null);
    getOrCreate(books, "a", "b", "b", "a", "a");
    CacheStatistics updatedCacheStatistics = provider
            .getCacheStatistics(this.cacheManager, books);
    assertCoreStatistics(updatedCacheStatistics, 2L, null, null);
}
项目:contestparser    文件:CacheStatisticsAutoConfigurationTests.java   
@Test
public void noOpCacheStatistics() {
    load(NoOpCacheConfig.class);
    CacheStatisticsProvider provider = this.context
            .getBean("noOpCacheStatisticsProvider", CacheStatisticsProvider.class);
    Cache books = getCache("books");
    CacheStatistics cacheStatistics = provider.getCacheStatistics(this.cacheManager,
            books);
    assertCoreStatistics(cacheStatistics, null, null, null);
    getOrCreate(books, "a", "b", "b", "a", "a");
    CacheStatistics updatedCacheStatistics = provider
            .getCacheStatistics(this.cacheManager, books);
    assertCoreStatistics(updatedCacheStatistics, null, null, null);
}
项目:contestparser    文件:CacheStatisticsAutoConfigurationTests.java   
private void doTestCoreStatistics(CacheStatisticsProvider provider,
        boolean supportSize) {
    Cache books = getCache("books");
    CacheStatistics cacheStatistics = provider.getCacheStatistics(this.cacheManager,
            books);
    assertCoreStatistics(cacheStatistics, (supportSize ? 0L : null), null, null);
    getOrCreate(books, "a", "b", "b", "a", "a", "a");
    CacheStatistics updatedCacheStatistics = provider
            .getCacheStatistics(this.cacheManager, books);
    assertCoreStatistics(updatedCacheStatistics, (supportSize ? 2L : null), 0.66D,
            0.33D);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:PublicMetricsAutoConfiguration.java   
@Bean
@ConditionalOnMissingBean
@ConditionalOnBean(CacheStatisticsProvider.class)
public CachePublicMetrics cachePublicMetrics() {
    return new CachePublicMetrics();
}
项目:spring-boot-concourse    文件:PublicMetricsAutoConfiguration.java   
@Bean
@ConditionalOnMissingBean
@ConditionalOnBean(CacheStatisticsProvider.class)
public CachePublicMetrics cachePublicMetrics() {
    return new CachePublicMetrics();
}
项目:contestparser    文件:PublicMetricsAutoConfiguration.java   
@Bean
@ConditionalOnMissingBean
@ConditionalOnBean(CacheStatisticsProvider.class)
public CachePublicMetrics cachePublicMetrics() {
    return new CachePublicMetrics();
}