Package org.infinispan.stats.container

Examples of org.infinispan.stats.container.ConcurrentGlobalContainer


      assertFinalState(globalContainer);
   }

   public void testIsolationWithEnqueueAndResetSingleAction() {
      final ConcurrentGlobalContainer globalContainer = new ConcurrentGlobalContainer(TIME_SERVICE);
      final List<StatisticsSnapshot> snapshots = new ArrayList<StatisticsSnapshot>(4);
      snapshots.add(globalContainer.getSnapshot());

      //two random stats, one local and one remote
      final ExtendedStatistic localStat = ExtendedStatistic.PREPARE_COMMAND_SIZE;
      final ExtendedStatistic remoteStat = ExtendedStatistic.NUM_COMMITTED_WR_TX;

      Assert.assertTrue(localStat.isLocal());
      Assert.assertTrue(remoteStat.isRemote());

      globalContainer.flushing().set(true);

      globalContainer.add(localStat, 10, true);
      globalContainer.add(remoteStat, 20, false);

      snapshots.add(globalContainer.getSnapshot());

      assertSnapshotValues(snapshots, Arrays.asList(0D, 0D), localStat, true);
      assertSnapshotValues(snapshots, Arrays.asList(0D, 0D), remoteStat, false);

      Assert.assertEquals(globalContainer.queue().size(), 2);
      globalContainer.flushing().set(false);

      snapshots.add(globalContainer.getSnapshot());

      assertSnapshotValues(snapshots, Arrays.asList(0D, 0D, 10D), localStat, true);
      assertSnapshotValues(snapshots, Arrays.asList(0D, 0D, 20D), remoteStat, false);

      globalContainer.reset();
      snapshots.clear();
      snapshots.add(globalContainer.getSnapshot());

      assertSnapshotValues(snapshots, Arrays.asList(0D), localStat, true);
      assertSnapshotValues(snapshots, Arrays.asList(0D), remoteStat, false);

      globalContainer.flushing().set(true);

      globalContainer.add(localStat, 10, true);
      globalContainer.add(remoteStat, 20, false);
      globalContainer.reset();

      snapshots.add(globalContainer.getSnapshot());
      Assert.assertTrue(globalContainer.isReset());
      Assert.assertEquals(globalContainer.queue().size(), 2);

      assertSnapshotValues(snapshots, Arrays.asList(0D, 0D), localStat, true);
      assertSnapshotValues(snapshots, Arrays.asList(0D, 0D), remoteStat, false);

      globalContainer.flushing().set(false);

      snapshots.add(globalContainer.getSnapshot());
      Assert.assertFalse(globalContainer.isReset());
      Assert.assertTrue(globalContainer.queue().isEmpty());

      assertSnapshotValues(snapshots, Arrays.asList(0D, 0D, 0D), localStat, true);
      assertSnapshotValues(snapshots, Arrays.asList(0D, 0D, 0D), remoteStat, false);

      assertFinalState(globalContainer);
View Full Code Here


   @Override
   protected void setup() throws Exception {
      super.setup();
      CacheStatisticManager manager = (CacheStatisticManager) extractField(extendedStatisticInterceptor, "cacheStatisticManager");
      CacheStatisticCollector collector = (CacheStatisticCollector) extractField(manager, "cacheStatisticCollector");
      ConcurrentGlobalContainer globalContainer = (ConcurrentGlobalContainer) extractField(collector, "globalContainer");
      replaceField(TEST_TIME_SERVICE, "timeService", manager, CacheStatisticManager.class);
      replaceField(TEST_TIME_SERVICE, "timeService", collector, CacheStatisticCollector.class);
      replaceField(TEST_TIME_SERVICE, "timeService", globalContainer, ConcurrentGlobalContainer.class);
      replaceField(TEST_TIME_SERVICE, "timeService", extendedStatisticInterceptor, ExtendedStatisticInterceptor.class);
      replaceField(TEST_TIME_SERVICE, "timeService", extractLockManager(cache()), ExtendedStatisticLockManager.class);
View Full Code Here

      for (int i = 0; i < NUM_NODES; ++i) {
         lockManagers[i] = extractLockManager(cache(i));
         ExtendedStatisticInterceptor interceptor = extendedStatisticInterceptors[i];
         CacheStatisticManager manager = (CacheStatisticManager) extractField(interceptor, "cacheStatisticManager");
         CacheStatisticCollector collector = (CacheStatisticCollector) extractField(manager, "cacheStatisticCollector");
         ConcurrentGlobalContainer globalContainer = (ConcurrentGlobalContainer) extractField(collector, "globalContainer");
         replaceField(TEST_TIME_SERVICE, "timeService", manager, CacheStatisticManager.class);
         replaceField(TEST_TIME_SERVICE, "timeService", collector, CacheStatisticCollector.class);
         replaceField(TEST_TIME_SERVICE, "timeService", globalContainer, ConcurrentGlobalContainer.class);
         replaceField(TEST_TIME_SERVICE, "timeService", interceptor, ExtendedStatisticInterceptor.class);
         replaceField(TEST_TIME_SERVICE, "timeService", lockManagers[i], ExtendedStatisticLockManager.class);
View Full Code Here

      waitForClusterToForm();
      for (int i = 0; i < NUM_NODES; ++i) {
         ExtendedStatisticInterceptor interceptor = extendedStatisticInterceptors[i];
         CacheStatisticManager manager = (CacheStatisticManager) extractField(interceptor, "cacheStatisticManager");
         CacheStatisticCollector collector = (CacheStatisticCollector) extractField(manager, "cacheStatisticCollector");
         ConcurrentGlobalContainer globalContainer = (ConcurrentGlobalContainer) extractField(collector, "globalContainer");
         ExtendedStatisticRpcManager rpcManager = (ExtendedStatisticRpcManager) extractComponent(cache(i), RpcManager.class);
         ExtendedStatisticLockManager lockManager = (ExtendedStatisticLockManager) extractLockManager(cache(i));
         lockManagers[i] = lockManager;
         replaceField(TEST_TIME_SERVICE, "timeService", manager, CacheStatisticManager.class);
         replaceField(TEST_TIME_SERVICE, "timeService", collector, CacheStatisticCollector.class);
View Full Code Here

TOP

Related Classes of org.infinispan.stats.container.ConcurrentGlobalContainer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.