test_class.declarator: stream
test_class.original_string: RollingCollapserBatchSizeDistributionStream stream;
test_class.type: RollingCollapserBatchSizeDistributionStream
test_class.var_name: stream
test_class.declarator: context
test_class.original_string: HystrixRequestContext context;
test_class.type: HystrixRequestContext
test_class.var_name: context
test_class.file: hystrix-core/src/test/java/com/netflix/hystrix/metric/consumer/RollingCollapserBatchSizeDistributionStreamTest.java
test_class.identifier: RollingCollapserBatchSizeDistributionStreamTest
test_class.superclass: extends CommandStreamTest
test_case.body: @Test
      public void testBatchesAgeOut() {
          HystrixCollapserKey key = HystrixCollapserKey.Factory.asKey("Collapser-Batch-Size-B");
          stream = RollingCollapserBatchSizeDistributionStream.getInstance(key, 10, 100);
          stream.startCachingStreamValuesIfUnstarted();
  
          final CountDownLatch latch = new CountDownLatch(1);
          stream.observe().take(30).subscribe(new Subscriber<CachedValuesHistogram>() {
              @Override
              public void onCompleted() {
                  latch.countDown();
              }
  
              @Override
              public void onError(Throwable e) {
                  fail(e.getMessage());
              }
  
              @Override
              public void onNext(CachedValuesHistogram distribution) {
                  System.out.println("OnNext @ " + System.currentTimeMillis());
              }
          });
  
          Collapser.from(key, 1).observe();
          Collapser.from(key, 2).observe();
          Collapser.from(key, 3).observe();
  
          try {
              Thread.sleep(200);
          } catch (InterruptedException ex) {
              fail("Interrupted ex");
          }
  
          Collapser.from(key, 4).observe();
  
          try {
              Thread.sleep(200);
          } catch (InterruptedException ex) {
              fail("Interrupted ex");
          }
  
          Collapser.from(key, 5).observe();
          Collapser.from(key, 6).observe();
          Collapser.from(key, 7).observe();
          Collapser.from(key, 8).observe();
          Collapser.from(key, 9).observe();
  
          try {
              Thread.sleep(200);
          } catch (InterruptedException ex) {
              fail("Interrupted ex");
          }
  
          Collapser.from(key, 10).observe();
          Collapser.from(key, 11).observe();
          Collapser.from(key, 12).observe();
  
          try {
              assertTrue(latch.await(10000, TimeUnit.MILLISECONDS));
          } catch (InterruptedException ex) {
              fail("Interrupted ex");
          }
  
          assertEquals(0, stream.getLatest().getTotalCount());
          assertEquals(0, stream.getLatestMean());
      }
test_case.class_method_signature: RollingCollapserBatchSizeDistributionStreamTest.testBatchesAgeOut()
test_case.full_signature: @Test public void testBatchesAgeOut()
test_case.identifier: testBatchesAgeOut
test_case.invocations: asKey getInstance startCachingStreamValuesIfUnstarted subscribe take observe countDown fail getMessage println currentTimeMillis observe from observe from observe from sleep fail observe from sleep fail observe from observe from observe from observe from observe from sleep fail observe from observe from observe from assertTrue await fail assertEquals getTotalCount getLatest assertEquals getLatestMean
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testBatchesAgeOut()
focal_class.declarator: streams = new ConcurrentHashMap<String, RollingCollapserBatchSizeDistributionStream>()
focal_class.modifier: private static final
focal_class.original_string: private static final ConcurrentMap<String, RollingCollapserBatchSizeDistributionStream> streams = new ConcurrentHashMap<String, RollingCollapserBatchSizeDistributionStream>();
focal_class.type: ConcurrentMap<String, RollingCollapserBatchSizeDistributionStream>
focal_class.var_name: streams
focal_class.declarator: addValuesToBucket = new Func2<Histogram, HystrixCollapserEvent, Histogram>() {
          @Override
          public Histogram call(Histogram initialDistribution, HystrixCollapserEvent event) {
              switch (event.getEventType()) {
                  case ADDED_TO_BATCH:
                      if (event.getCount() > -1) {
                          initialDistribution.recordValue(event.getCount());
                      }
                      break;
                  default:
                      //do nothing
                      break;
              }
              return initialDistribution;
          }
      }
focal_class.modifier: private static final
focal_class.original_string: private static final Func2<Histogram, HystrixCollapserEvent, Histogram> addValuesToBucket = new Func2<Histogram, HystrixCollapserEvent, Histogram>() {
          @Override
          public Histogram call(Histogram initialDistribution, HystrixCollapserEvent event) {
              switch (event.getEventType()) {
                  case ADDED_TO_BATCH:
                      if (event.getCount() > -1) {
                          initialDistribution.recordValue(event.getCount());
                      }
                      break;
                  default:
                      //do nothing
                      break;
              }
              return initialDistribution;
          }
      };
focal_class.type: Func2<Histogram, HystrixCollapserEvent, Histogram>
focal_class.var_name: addValuesToBucket
focal_class.file: hystrix-core/src/main/java/com/netflix/hystrix/metric/consumer/RollingCollapserBatchSizeDistributionStream.java
focal_class.identifier: RollingCollapserBatchSizeDistributionStream
focal_class.class_method_signature: RollingCollapserBatchSizeDistributionStream.getInstance(HystrixCollapserKey collapserKey, HystrixCollapserProperties properties)
focal_class.full_signature: public static RollingCollapserBatchSizeDistributionStream getInstance(HystrixCollapserKey collapserKey, HystrixCollapserProperties properties)
focal_class.identifier: getInstance
focal_class.modifiers: public static
focal_class.parameters: (HystrixCollapserKey collapserKey, HystrixCollapserProperties properties)
focal_class.return: RollingCollapserBatchSizeDistributionStream
focal_class.signature: RollingCollapserBatchSizeDistributionStream getInstance(HystrixCollapserKey collapserKey, HystrixCollapserProperties properties)
focal_class.class_method_signature: RollingCollapserBatchSizeDistributionStream.getInstance(HystrixCollapserKey collapserKey, int numBuckets, int bucketSizeInMs)
focal_class.full_signature: public static RollingCollapserBatchSizeDistributionStream getInstance(HystrixCollapserKey collapserKey, int numBuckets, int bucketSizeInMs)
focal_class.identifier: getInstance
focal_class.modifiers: public static
focal_class.parameters: (HystrixCollapserKey collapserKey, int numBuckets, int bucketSizeInMs)
focal_class.return: RollingCollapserBatchSizeDistributionStream
focal_class.signature: RollingCollapserBatchSizeDistributionStream getInstance(HystrixCollapserKey collapserKey, int numBuckets, int bucketSizeInMs)
focal_class.class_method_signature: RollingCollapserBatchSizeDistributionStream.reset()
focal_class.full_signature: public static void reset()
focal_class.identifier: reset
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void reset()
focal_class.class_method_signature: RollingCollapserBatchSizeDistributionStream.RollingCollapserBatchSizeDistributionStream(HystrixCollapserKey collapserKey, int numPercentileBuckets, int percentileBucketSizeInMs)
focal_class.full_signature: private  RollingCollapserBatchSizeDistributionStream(HystrixCollapserKey collapserKey, int numPercentileBuckets, int percentileBucketSizeInMs)
focal_class.identifier: RollingCollapserBatchSizeDistributionStream
focal_class.modifiers: private
focal_class.parameters: (HystrixCollapserKey collapserKey, int numPercentileBuckets, int percentileBucketSizeInMs)
focal_class.signature:  RollingCollapserBatchSizeDistributionStream(HystrixCollapserKey collapserKey, int numPercentileBuckets, int percentileBucketSizeInMs)
focal_class.superclass: extends RollingDistributionStream<HystrixCollapserEvent>
focal_method.body: public static RollingCollapserBatchSizeDistributionStream getInstance(HystrixCollapserKey collapserKey, HystrixCollapserProperties properties) {
          final int percentileMetricWindow = properties.metricsRollingPercentileWindowInMilliseconds().get();
          final int numPercentileBuckets = properties.metricsRollingPercentileWindowBuckets().get();
          final int percentileBucketSizeInMs = percentileMetricWindow / numPercentileBuckets;
  
          return getInstance(collapserKey, numPercentileBuckets, percentileBucketSizeInMs);
      }
focal_method.class_method_signature: RollingCollapserBatchSizeDistributionStream.getInstance(HystrixCollapserKey collapserKey, HystrixCollapserProperties properties)
focal_method.full_signature: public static RollingCollapserBatchSizeDistributionStream getInstance(HystrixCollapserKey collapserKey, HystrixCollapserProperties properties)
focal_method.identifier: getInstance
focal_method.invocations: get metricsRollingPercentileWindowInMilliseconds get metricsRollingPercentileWindowBuckets getInstance
focal_method.modifiers: public static
focal_method.parameters: (HystrixCollapserKey collapserKey, HystrixCollapserProperties properties)
focal_method.return: RollingCollapserBatchSizeDistributionStream
focal_method.signature: RollingCollapserBatchSizeDistributionStream getInstance(HystrixCollapserKey collapserKey, HystrixCollapserProperties properties)