test_class.declarator: ctx = new HystrixRequestContextRule()
test_class.modifier: @Rule
      public
test_class.original_string: @Rule
      public HystrixRequestContextRule ctx = new HystrixRequestContextRule();
test_class.type: HystrixRequestContextRule
test_class.var_name: ctx
test_class.declarator: stream
test_class.original_string: HystrixDashboardStream stream;
test_class.type: HystrixDashboardStream
test_class.var_name: stream
test_class.declarator: groupKey = HystrixCommandGroupKey.Factory.asKey("Dashboard")
test_class.modifier: private final static
test_class.original_string: private final static HystrixCommandGroupKey groupKey = HystrixCommandGroupKey.Factory.asKey("Dashboard");
test_class.type: HystrixCommandGroupKey
test_class.var_name: groupKey
test_class.declarator: commandKey = HystrixCommandKey.Factory.asKey("DashboardCommand")
test_class.modifier: private final static
test_class.original_string: private final static HystrixCommandKey commandKey = HystrixCommandKey.Factory.asKey("DashboardCommand");
test_class.type: HystrixCommandKey
test_class.var_name: commandKey
test_class.file: hystrix-core/src/test/java/com/netflix/hystrix/metric/consumer/HystrixDashboardStreamTest.java
test_class.identifier: HystrixDashboardStreamTest
test_class.superclass: extends CommandStreamTest
test_case.body: @Test
      public void testTwoSubscribersOneUnsubscribes() throws Exception {
          final CountDownLatch latch1 = new CountDownLatch(1);
          final CountDownLatch latch2 = new CountDownLatch(1);
          final AtomicInteger payloads1 = new AtomicInteger(0);
          final AtomicInteger payloads2 = new AtomicInteger(0);
  
          Subscription s1 = stream
                  .observe()
                  .take(100)
                  .doOnUnsubscribe(new Action0() {
                      @Override
                      public void call() {
                          latch1.countDown();
                      }
                  })
                  .subscribe(new Subscriber<HystrixDashboardStream.DashboardData>() {
                      @Override
                      public void onCompleted() {
                          System.out.println(System.currentTimeMillis() + " : " + Thread.currentThread().getName() + " : Dashboard 1 OnCompleted");
                          latch1.countDown();
                      }
  
                      @Override
                      public void onError(Throwable e) {
                          System.out.println(System.currentTimeMillis() + " : " + Thread.currentThread().getName() + " : Dashboard 1 OnError : " + e);
                          latch1.countDown();
                      }
  
                      @Override
                      public void onNext(HystrixDashboardStream.DashboardData dashboardData) {
                          System.out.println(System.currentTimeMillis() + " : " + Thread.currentThread().getName() + " : Dashboard 1 OnNext : " + dashboardData);
                          payloads1.incrementAndGet();
                      }
                  });
  
          Subscription s2 = stream
                  .observe()
                  .take(100)
                  .doOnUnsubscribe(new Action0() {
                      @Override
                      public void call() {
                          latch2.countDown();
                      }
                  })
                  .subscribe(new Subscriber<HystrixDashboardStream.DashboardData>() {
                      @Override
                      public void onCompleted() {
                          System.out.println(System.currentTimeMillis() + " : " + Thread.currentThread().getName() + " : Dashboard 2 OnCompleted");
                          latch2.countDown();
                      }
  
                      @Override
                      public void onError(Throwable e) {
                          System.out.println(System.currentTimeMillis() + " : " + Thread.currentThread().getName() + " : Dashboard 2 OnError : " + e);
                          latch2.countDown();
                      }
  
                      @Override
                      public void onNext(HystrixDashboardStream.DashboardData dashboardData) {
                          System.out.println(System.currentTimeMillis() + " : " + Thread.currentThread().getName() + " : Dashboard 2 OnNext : " + dashboardData);
                          payloads2.incrementAndGet();
                      }
                  });
          //execute 1 command, then unsubscribe from first stream. then execute the rest
          for (int i = 0; i < 50; i++) {
              HystrixCommand<Integer> cmd = Command.from(groupKey, commandKey, HystrixEventType.SUCCESS, 50);
              cmd.execute();
              if (i == 1) {
                  s1.unsubscribe();
              }
          }
  
          assertTrue(latch1.await(10000, TimeUnit.MILLISECONDS));
          assertTrue(latch2.await(10000, TimeUnit.MILLISECONDS));
          System.out.println("s1 got : " + payloads1.get() + ", s2 got : " + payloads2.get());
          assertTrue("s1 got data", payloads1.get() > 0);
          assertTrue("s2 got data", payloads2.get() > 0);
          assertTrue("s1 got less data than s2", payloads2.get() > payloads1.get());
      }
test_case.class_method_signature: HystrixDashboardStreamTest.testTwoSubscribersOneUnsubscribes()
test_case.full_signature: @Test public void testTwoSubscribersOneUnsubscribes()
test_case.identifier: testTwoSubscribersOneUnsubscribes
test_case.invocations: subscribe doOnUnsubscribe take observe countDown println currentTimeMillis getName currentThread countDown println currentTimeMillis getName currentThread countDown println currentTimeMillis getName currentThread incrementAndGet subscribe doOnUnsubscribe take observe countDown println currentTimeMillis getName currentThread countDown println currentTimeMillis getName currentThread countDown println currentTimeMillis getName currentThread incrementAndGet from execute unsubscribe assertTrue await assertTrue await println get get assertTrue get assertTrue get assertTrue get get
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testTwoSubscribersOneUnsubscribes()
focal_class.declarator: delayInMs
focal_class.modifier: final
focal_class.original_string: final int delayInMs;
focal_class.type: int
focal_class.var_name: delayInMs
focal_class.declarator: singleSource
focal_class.modifier: final
focal_class.original_string: final Observable<DashboardData> singleSource;
focal_class.type: Observable<DashboardData>
focal_class.var_name: singleSource
focal_class.declarator: isSourceCurrentlySubscribed = new AtomicBoolean(false)
focal_class.modifier: final
focal_class.original_string: final AtomicBoolean isSourceCurrentlySubscribed = new AtomicBoolean(false);
focal_class.type: AtomicBoolean
focal_class.var_name: isSourceCurrentlySubscribed
focal_class.declarator: dataEmissionIntervalInMs =
              DynamicPropertyFactory.getInstance().getIntProperty("hystrix.stream.dashboard.intervalInMilliseconds", 500)
focal_class.modifier: private static final
focal_class.original_string: private static final DynamicIntProperty dataEmissionIntervalInMs =
              DynamicPropertyFactory.getInstance().getIntProperty("hystrix.stream.dashboard.intervalInMilliseconds", 500);
focal_class.type: DynamicIntProperty
focal_class.var_name: dataEmissionIntervalInMs
focal_class.declarator: INSTANCE =
              new HystrixDashboardStream(dataEmissionIntervalInMs.get())
focal_class.modifier: private static final
focal_class.original_string: private static final HystrixDashboardStream INSTANCE =
              new HystrixDashboardStream(dataEmissionIntervalInMs.get());
focal_class.type: HystrixDashboardStream
focal_class.var_name: INSTANCE
focal_class.file: hystrix-core/src/main/java/com/netflix/hystrix/metric/consumer/HystrixDashboardStream.java
focal_class.identifier: HystrixDashboardStream
focal_class.class_method_signature: HystrixDashboardStream.HystrixDashboardStream(int delayInMs)
focal_class.full_signature: private  HystrixDashboardStream(int delayInMs)
focal_class.identifier: HystrixDashboardStream
focal_class.modifiers: private
focal_class.parameters: (int delayInMs)
focal_class.signature:  HystrixDashboardStream(int delayInMs)
focal_class.class_method_signature: HystrixDashboardStream.getInstance()
focal_class.full_signature: public static HystrixDashboardStream getInstance()
focal_class.identifier: getInstance
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: HystrixDashboardStream
focal_class.signature: HystrixDashboardStream getInstance()
focal_class.class_method_signature: HystrixDashboardStream.getNonSingletonInstanceOnlyUsedInUnitTests(int delayInMs)
focal_class.full_signature: static HystrixDashboardStream getNonSingletonInstanceOnlyUsedInUnitTests(int delayInMs)
focal_class.identifier: getNonSingletonInstanceOnlyUsedInUnitTests
focal_class.modifiers: static
focal_class.parameters: (int delayInMs)
focal_class.return: HystrixDashboardStream
focal_class.signature: HystrixDashboardStream getNonSingletonInstanceOnlyUsedInUnitTests(int delayInMs)
focal_class.class_method_signature: HystrixDashboardStream.observe()
focal_class.full_signature: public Observable<DashboardData> observe()
focal_class.identifier: observe
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: Observable<DashboardData>
focal_class.signature: Observable<DashboardData> observe()
focal_class.class_method_signature: HystrixDashboardStream.isSourceCurrentlySubscribed()
focal_class.full_signature: public boolean isSourceCurrentlySubscribed()
focal_class.identifier: isSourceCurrentlySubscribed
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isSourceCurrentlySubscribed()
focal_method.body: public Observable<DashboardData> observe() {
          return singleSource;
      }
focal_method.class_method_signature: HystrixDashboardStream.observe()
focal_method.full_signature: public Observable<DashboardData> observe()
focal_method.identifier: observe
focal_method.modifiers: public
focal_method.parameters: ()
focal_method.return: Observable<DashboardData>
focal_method.signature: Observable<DashboardData> observe()