当前位置: 首页>>代码示例>>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;未经允许,请勿转载。