Package rx

Examples of rx.Subscription.unsubscribe()


    @Override
    public void markUntainted(final BucketConfig config) {
        Subscription subscription = subscriptions.get(config.name());
        if (subscription != null) {
            LOGGER.debug("Config for bucket \"" + config.name() + "\" marked as untainted, stopping polling.");
            subscription.unsubscribe();
            subscriptions.remove(config.name());
        }
    }

    @Override
View Full Code Here


    Observable<Integer> oc = RemoteObservable.connect("localhost", serverPort, Codecs.integer());
    Subscription sub = oc.subscribe();

        assertFalse(sub.isUnsubscribed());
    Thread.sleep(1000); // allow a few iterations
    sub.unsubscribe();
    Thread.sleep(1000); // allow time for unsubscribe to propagate
        assertTrue(sub.isUnsubscribed());
    Assert.assertEquals(true, sourceSubscriptionUnsubscribed.getValue());
  }
 
View Full Code Here

        assertFalse(subscription.isUnsubscribed());
   
    Thread.sleep(1000); // allow a few iterations to complete
   
    // unsubscribe to client subscription
    subscription.unsubscribe();
    Thread.sleep(3000); // allow time for unsubscribe to propagate
    // check client
        assertTrue(subscription.isUnsubscribed());
    // check source
    Assert.assertEquals(true, sourceSubscriptionUnsubscribed.getValue());
View Full Code Here

    // Subscription that expects 0 elements
    Subscription sub=assertCountThenComplete(ob,0);
   
    // Cancel via unsubscribe should complete empty
    sub.unsubscribe();
  }
 
  @Test
  public void testSetTimerCancelAfter() {
    RxTimer timer=new RxTimer(vertx);
View Full Code Here

    final Subscription sub=assertCount(ob,1);
   
    vertx.setTimer(50+25,new Handler<Long>() {
      public void handle(Long event) {
        System.out.println("Trigger unsubscribe after timer");
        sub.unsubscribe();
        // All good
        testComplete();
      }
    });
  }
View Full Code Here

                        s = subscription;
                        subscription = null;
                        connectedSubject.set(null);
                    }
                    if (s != null) {
                        s.unsubscribe();
                    }
                }
            }));

            // now that everything is hooked up let's subscribe
View Full Code Here

            if (event.getType() == RemoteRxEvent.Type.subscribed){
              return handleSubscribeRequest(event, connection, slottingStrategyReference, unsubscribeCallbackReference);
            }else if (event.getType() == RemoteRxEvent.Type.unsubscribed){
              Subscription subscription = unsubscribeCallbackReference.getValue();
              if (subscription != null){
                subscription.unsubscribe();
              }
              releaseSlot(slottingStrategyReference.getValue(), connection);
              serverMetrics.incrementUnsubscribedCount();
              logger.debug("Connection: "+connection.toString()+" unsubscribed");
            }
View Full Code Here

            eventBus.publish(i);
        }
       
        Assert.assertTrue(counter.await(1, TimeUnit.SECONDS));
       
        sub.unsubscribe();
       
        Assert.assertTrue(completion.await(1, TimeUnit.SECONDS));
       
    }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.