Examples of Action0


Examples of rx.functions.Action0

                public void call(Subscriber<? super String> subscriber) {
                    try {
                        String nextLine;
                        final LineNumberReader reader =
                                new LineNumberReader(new InputStreamReader(new BufferedInputStream(new FileInputStream(file))));
                        subscriber.add(Subscriptions.create(new Action0() {
                            @Override
                            public void call() {
                                try {
                                    reader.close();
                                } catch (IOException e) {
View Full Code Here

Examples of rx.functions.Action0

         * If we do it before getting the existingListener then the write that happens after the flush() from the user
         * will be contained in the retrieved listener and hence we will wait till the next flush() finish.
         */
        nettyChannel.flush();
        return existingListener.asObservable()
                               .doOnCompleted(new Action0() {
                                   @Override
                                   public void call() {
                                       eventsSubject.onEvent(metricEventProvider.getFlushSuccessEvent(),
                                                             Clock.onEndMillis(startTimeMillis));
                                   }
View Full Code Here

Examples of rx.functions.Action0

                                 final ClientConnectionFactory<I, O,? extends ObservableConnection<I, O>> connectionFactory) {
        final long startTimeMillis = Clock.newStartTimeMillis();
        eventsSubject.onEvent(ClientMetricsEvent.CONNECT_START);
        final ChannelFuture connectFuture = clientBootstrap.connect(serverInfo.getHost(), serverInfo.getPort());

        subscriber.add(Subscriptions.create(new Action0() {
            @Override
            public void call() {
                if (!connectFuture.isDone()) {
                    connectFuture.cancel(true); // Unsubscribe here means, no more connection is required. A close on connection is explicit.
                }
View Full Code Here

Examples of rx.functions.Action0

        throwIfErrorOccured(exception);
    }

    @Override
    public Subscription subscribe(final MetricEventsListener<? extends E> listener) {
        Subscription subscription = Subscriptions.create(new Action0() {
            @Override
            public void call() {
                listeners.remove(listener);
            }
        });
View Full Code Here

Examples of rx.functions.Action0

                // the line of the producer
                state.buffer.sendAllNotifications(subscriber);

                // register real observer for pass-thru ... and drain any further events received on first notification
                state.setObserverRef(new PassThruObserver<T>(subscriber, state));
                subscriber.add(Subscriptions.create(new Action0() {
                    @Override
                    public void call() {
                        if (null != state.onUnsubscribe) {
                            state.onUnsubscribe.call();
                        }
View Full Code Here

Examples of rx.functions.Action0

      new Action1<Throwable>() {
        public void call(Throwable t) {
          rx.onError(t);
        }
      },
      new Action0() {
        public void call() {
          rx.onNext(total.get());
          rx.onCompleted();
        }
      }
View Full Code Here

Examples of rx.functions.Action0

        public void call(Throwable t) {
          target.clear();
          rx.onError(t);
        }
      },
      new Action0() {
        public void call() {
          target.complete(new Handler<Void>() {
            public void handle(Void event) {
              rx.onCompleted();
            }
View Full Code Here

Examples of rx.functions.Action0

    Observable<Long> ob=timer.setPeriodic(50).take(3);

    final long startTime=System.currentTimeMillis();

    // Expect 3 values
    final Subscription sub=assertCountThen(ob,new Action0() {
      public void call() {
        long totalTime=System.currentTimeMillis()-startTime;
        System.out.println("Test complete after "+(totalTime)+"ms");
        // Ensure the total time is withing 20% of the expected value
        assertTrue("Time within 20% of expected",Math.abs((totalTime/(50*3))-1)<0.2);
 
View Full Code Here

Examples of rx.functions.Action0

      new Action1<Throwable>() {
        public void call(Throwable t) {
          fail("Error while mapping message (t="+t+")");
        }
      },
      new Action0() {
        public void call() {
          assertEquals(0,count.get());
          testComplete();
        }
      });
View Full Code Here

Examples of rx.functions.Action0

    assertSequence(in,value);
  }

  /** Assert a sequence */
  public static <T> void assertSequence(Observable<T> in, final T... exp) {
    assertSequenceThen(in, new Action0() {
      @Override public void call() {
        // Do nothing
      }
    }, exp);
  }
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.