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 testEmptyStreamProducesEmptyDistributions() {
          HystrixCollapserKey key = HystrixCollapserKey.Factory.asKey("Collapser-Batch-Size-A");
          stream = RollingCollapserBatchSizeDistributionStream.getInstance(key, 10, 100);
          stream.startCachingStreamValuesIfUnstarted();
  
          final CountDownLatch latch = new CountDownLatch(1);
          stream.observe().skip(10).take(10).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());
                  assertEquals(0, distribution.getTotalCount());
              }
          });
  
          //no writes
  
          try {
              assertTrue(latch.await(10000, TimeUnit.MILLISECONDS));
          } catch (InterruptedException ex) {
              fail("Interrupted ex");
          }
          assertEquals(0, stream.getLatest().getTotalCount());
      }
test_case.class_method_signature: RollingCollapserBatchSizeDistributionStreamTest.testEmptyStreamProducesEmptyDistributions()
test_case.full_signature: @Test public void testEmptyStreamProducesEmptyDistributions()
test_case.identifier: testEmptyStreamProducesEmptyDistributions
test_case.invocations: asKey getInstance startCachingStreamValuesIfUnstarted subscribe take skip observe countDown fail getMessage println currentTimeMillis assertEquals getTotalCount assertTrue await fail assertEquals getTotalCount getLatest
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testEmptyStreamProducesEmptyDistributions()
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)