use of com.alicp.jetcache.MonitoredCache in project jetcache by alibaba.
the class DefaultCacheMonitorTest method testWithManager.
@Test
public void testWithManager() throws Exception {
Cache c1 = createCache();
DefaultCacheMonitor m1 = new DefaultCacheMonitor("cache1");
Cache c2 = createCache();
DefaultCacheMonitor m2 = new DefaultCacheMonitor("cache2");
c1 = new MonitoredCache(c1, m1);
c2 = new MonitoredCache(c2, m2);
DefaultCacheMonitorManager manager = new DefaultCacheMonitorManager(2, TimeUnit.SECONDS);
manager.start();
manager.add(m1, m2);
basetest(c1, m1);
basetest(c2, m2);
Cache mc = new MultiLevelCache(c1, c2);
DefaultCacheMonitor mcm = new DefaultCacheMonitor("multiCache");
mc = new MonitoredCache(mc, mcm);
manager.add(mcm);
basetest(mc, mcm);
manager.stop();
// Thread.sleep(10000);
}
Aggregations