本文整理汇总了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();
}
示例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;
}
}
示例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();
}
}
示例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;
}
示例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;
}
示例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();
}
示例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));
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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();
}
示例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();
}
示例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();
}