當前位置: 首頁>>代碼示例>>Java>>正文


Java Subscriptions.unsubscribed方法代碼示例

本文整理匯總了Java中rx.subscriptions.Subscriptions.unsubscribed方法的典型用法代碼示例。如果您正苦於以下問題:Java Subscriptions.unsubscribed方法的具體用法?Java Subscriptions.unsubscribed怎麽用?Java Subscriptions.unsubscribed使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在rx.subscriptions.Subscriptions的用法示例。


在下文中一共展示了Subscriptions.unsubscribed方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: enqueue

import rx.subscriptions.Subscriptions; //導入方法依賴的package包/類
private Subscription enqueue(Action0 action, long execTime) {
    if (this.innerSubscription.isUnsubscribed()) {
        return Subscriptions.unsubscribed();
    }
    final TimedAction timedAction = new TimedAction(action, Long.valueOf(execTime), this.counter.incrementAndGet());
    this.queue.add(timedAction);
    if (this.wip.getAndIncrement() != 0) {
        return Subscriptions.create(new Action0() {
            public void call() {
                InnerCurrentThreadScheduler.this.queue.remove(timedAction);
            }
        });
    }
    do {
        TimedAction polled = (TimedAction) this.queue.poll();
        if (polled != null) {
            polled.action.call();
        }
    } while (this.wip.decrementAndGet() > 0);
    return Subscriptions.unsubscribed();
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:22,代碼來源:TrampolineScheduler.java

示例2: schedule

import rx.subscriptions.Subscriptions; //導入方法依賴的package包/類
public Subscription schedule(Action0 action) {
    if (isUnsubscribed()) {
        return Subscriptions.unsubscribed();
    }
    Subscription ea = new ScheduledAction(action, this.tasks);
    this.tasks.add(ea);
    this.queue.offer(ea);
    if (this.wip.getAndIncrement() != 0) {
        return ea;
    }
    try {
        this.executor.execute(this);
        return ea;
    } catch (RejectedExecutionException t) {
        this.tasks.remove(ea);
        this.wip.decrementAndGet();
        RxJavaPlugins.getInstance().getErrorHandler().handleError(t);
        throw t;
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:21,代碼來源:ExecutorScheduler.java

示例3: call

import rx.subscriptions.Subscriptions; //導入方法依賴的package包/類
public Subscription call(final TimeoutSubscriber<T> timeoutSubscriber, final Long seqId, Worker inner) {
    if (this.val$firstTimeoutSelector == null) {
        return Subscriptions.unsubscribed();
    }
    try {
        return ((Observable) this.val$firstTimeoutSelector.call()).unsafeSubscribe(new Subscriber<U>() {
            public void onCompleted() {
                timeoutSubscriber.onTimeout(seqId.longValue());
            }

            public void onError(Throwable e) {
                timeoutSubscriber.onError(e);
            }

            public void onNext(U u) {
                timeoutSubscriber.onTimeout(seqId.longValue());
            }
        });
    } catch (Throwable t) {
        Exceptions.throwOrReport(t, timeoutSubscriber);
        return Subscriptions.unsubscribed();
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:24,代碼來源:OperatorTimeoutWithSelector.java

示例4: schedule

import rx.subscriptions.Subscriptions; //導入方法依賴的package包/類
@Override public Subscription schedule(Action0 action, long delayTime, TimeUnit unit) {
  if (compositeSubscription.isUnsubscribed()) {
    return Subscriptions.unsubscribed();
  }

  action = RxAndroidPlugins.getInstance().getSchedulersHook().onSchedule(action);

  final ScheduledAction scheduledAction = new ScheduledAction(action);
  scheduledAction.addParent(compositeSubscription);
  compositeSubscription.add(scheduledAction);

  handler.postDelayed(scheduledAction, unit.toMillis(delayTime));

  scheduledAction.add(Subscriptions.create(new Action0() {
    @Override public void call() {
      //Log.e(TAG, "HandlerScheduler has unsubscribed");
      handler.removeCallbacks(scheduledAction);
    }
  }));

  return scheduledAction;
}
 
開發者ID:J1aDong,項目名稱:Gank-Meizi,代碼行數:23,代碼來源:HandlerScheduler.java

示例5: schedule

import rx.subscriptions.Subscriptions; //導入方法依賴的package包/類
@Override
public Subscription schedule(Action0 action, long delayTime, TimeUnit unit) {
    if (compositeSubscription.isUnsubscribed()) {
        return Subscriptions.unsubscribed();
    }

    action = RxAndroidPlugins.getInstance().getSchedulersHook().onSchedule(action);

    final ScheduledAction scheduledAction = new ScheduledAction(action);
    scheduledAction.addParent(compositeSubscription);
    compositeSubscription.add(scheduledAction);

    handler.postDelayed(scheduledAction, unit.toMillis(delayTime));

    scheduledAction.add(Subscriptions.create(new Action0() {
        @Override
        public void call() {
            handler.removeCallbacks(scheduledAction);
        }
    }));

    return scheduledAction;
}
 
開發者ID:cowthan,項目名稱:AyoSunny,代碼行數:24,代碼來源:HandlerScheduler.java

示例6: ShotsPresenter

import rx.subscriptions.Subscriptions; //導入方法依賴的package包/類
@Inject
ShotsPresenter(ShotsController shotsController, LikeShotController likeShotController,
               BucketsController bucketsController, ErrorController errorController,
               FollowersController followersController, RxBus rxBus, SettingsController settingsController) {

    this.shotsController = shotsController;
    this.likeShotController = likeShotController;
    this.bucketsController = bucketsController;
    this.errorController = errorController;
    this.followersController = followersController;
    this.rxBus = rxBus;
    this.settingsController = settingsController;
    subscriptions = new CompositeSubscription();
    refreshSubscription = Subscriptions.unsubscribed();
    loadMoreSubscription = Subscriptions.unsubscribed();
    busSubscription = Subscriptions.unsubscribed();
    busUpdateShotSubscription = Subscriptions.unsubscribed();
}
 
開發者ID:netguru,項目名稱:inbbbox-android,代碼行數:19,代碼來源:ShotsPresenter.java

示例7: whenRefreshCalledAndNextRequestInProgress_thenStopAndLoadNewData

import rx.subscriptions.Subscriptions; //導入方法依賴的package包/類
@Test
public void whenRefreshCalledAndNextRequestInProgress_thenStopAndLoadNewData() throws Exception {
    //given
    TestSubscriber loadNextShotsSubscription = new TestSubscriber();
    presenter.refreshShotsSubscription = Subscriptions.unsubscribed();
    presenter.loadNextShotsSubscription = loadNextShotsSubscription;
    when(bucketsControllerMock.getShotsFromBucket(anyLong(), anyInt(), anyInt(), anyBoolean()))
            .thenReturn(Single.just(shots));
    //when
    presenter.refreshShots();
    //then
    loadNextShotsSubscription.assertUnsubscribed();
    verify(view, times(1)).hideProgressbar();
    verify(view, times(1)).setData(any(List.class));
    verify(view, never()).addShots(any(List.class));
}
 
開發者ID:netguru,項目名稱:inbbbox-android,代碼行數:17,代碼來源:BucketDetailsPresenterTest.java

示例8: schedule

import rx.subscriptions.Subscriptions; //導入方法依賴的package包/類
public Subscription schedule(Action0 action, long delayTime, TimeUnit unit) {
    if (this.unsubscribed) {
        return Subscriptions.unsubscribed();
    }
    Subscription scheduledAction = new ScheduledAction(this.hook.onSchedule(action), this.handler);
    Message message = Message.obtain(this.handler, scheduledAction);
    message.obj = this;
    this.handler.sendMessageDelayed(message, unit.toMillis(delayTime));
    if (!this.unsubscribed) {
        return scheduledAction;
    }
    this.handler.removeCallbacks(scheduledAction);
    return Subscriptions.unsubscribed();
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:15,代碼來源:LooperScheduler.java

示例9: schedule

import rx.subscriptions.Subscriptions; //導入方法依賴的package包/類
public Subscription schedule(Action0 action, long delayTime, TimeUnit unit) {
    if (this.innerSubscription.isUnsubscribed()) {
        return Subscriptions.unsubscribed();
    }
    Subscription s = this.threadWorker.scheduleActual(action, delayTime, unit);
    this.innerSubscription.add(s);
    s.addParent(this.innerSubscription);
    return s;
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:10,代碼來源:CachedThreadScheduler.java

示例10: schedule

import rx.subscriptions.Subscriptions; //導入方法依賴的package包/類
public Subscription schedule(Action0 action, long delayTime, TimeUnit unit) {
    if (this.compositeSubscription.isUnsubscribed()) {
        return Subscriptions.unsubscribed();
    }
    final Subscription scheduledAction = new ScheduledAction(RxAndroidPlugins.getInstance().getSchedulersHook().onSchedule(action));
    scheduledAction.addParent(this.compositeSubscription);
    this.compositeSubscription.add(scheduledAction);
    this.handler.postDelayed(scheduledAction, unit.toMillis(delayTime));
    scheduledAction.add(Subscriptions.create(new Action0() {
        public void call() {
            HandlerWorker.this.handler.removeCallbacks(scheduledAction);
        }
    }));
    return scheduledAction;
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:16,代碼來源:HandlerScheduler.java

示例11: schedule

import rx.subscriptions.Subscriptions; //導入方法依賴的package包/類
@Override
public Subscription schedule(Action0 action, long delayTime, TimeUnit unit) {
    if (unsubscribed) {
        return Subscriptions.unsubscribed();
    }

    action = hook.onSchedule(action);

    // short cut and run now.
    if (delayTime == 0 && isTargetThread()) {
        action.call();
        return Subscriptions.unsubscribed();
    }

    ScheduledAction scheduledAction = new ScheduledAction(action, handler);

    Message message = Message.obtain(handler, scheduledAction);
    message.obj = this; // Used as token for unsubscription operation.

    handler.sendMessageDelayed(message, unit.toMillis(delayTime));

    if (unsubscribed) {
        handler.removeCallbacks(scheduledAction);
        return Subscriptions.unsubscribed();
    }

    return scheduledAction;
}
 
開發者ID:M4lik,項目名稱:burning-series,代碼行數:29,代碼來源:LooperScheduler.java

示例12: bindBidirectional

import rx.subscriptions.Subscriptions; //導入方法依賴的package包/類
@NonNull
public static <T> Subscription bindBidirectional(@NonNull Property<T> p1, @NonNull Property<T> p2) {
    if (p1 == p2) {
        return Subscriptions.unsubscribed();
    }
    Subscription s1 = p1.bind(p2);
    Subscription s2 = p2.bind(p1);
    return Subscriptions.from(s1, s2);
}
 
開發者ID:plenprojectcompany,項目名稱:plen-Scenography_Android,代碼行數:10,代碼來源:Property.java

示例13: ProjectPresenter

import rx.subscriptions.Subscriptions; //導入方法依賴的package包/類
@Inject
public ProjectPresenter(ProjectWithShots projectWithShots,
                        ProjectsController projectsController,
                        ErrorController errorController) {
    this.projectWithShots = projectWithShots;
    this.projectsController = projectsController;
    this.errorController = errorController;

    refreshSubscription = Subscriptions.unsubscribed();
    loadMoreSubscription = Subscriptions.unsubscribed();
}
 
開發者ID:netguru,項目名稱:inbbbox-android,代碼行數:12,代碼來源:ProjectPresenter.java

示例14: LikesPresenter

import rx.subscriptions.Subscriptions; //導入方法依賴的package包/類
@Inject
LikesPresenter(LikeShotController likedShotsController,
               ErrorController errorController,
               RxBus rxBus) {
    this.likedShotsController = likedShotsController;
    this.errorController = errorController;
    this.rxBus = rxBus;
    refreshSubscription = Subscriptions.unsubscribed();
    loadMoreLikesSubscription = Subscriptions.unsubscribed();
    busSubscription = Subscriptions.unsubscribed();
}
 
開發者ID:netguru,項目名稱:inbbbox-android,代碼行數:12,代碼來源:LikesPresenter.java

示例15: TeamInfoPresenter

import rx.subscriptions.Subscriptions; //導入方法依賴的package包/類
@Inject
public TeamInfoPresenter(TeamController teamController, UserShotsController userShotsController,
                         ErrorController errorController, User user, RxBus rxBus,
                         BucketsController bucketsController) {
    this.teamController = teamController;
    this.userShotsController = userShotsController;
    this.errorController = errorController;
    this.user = user;
    refreshSubscription = Subscriptions.unsubscribed();
    loadNextUsersSubscription = Subscriptions.unsubscribed();
}
 
開發者ID:netguru,項目名稱:inbbbox-android,代碼行數:12,代碼來源:TeamInfoPresenter.java


注:本文中的rx.subscriptions.Subscriptions.unsubscribed方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。