本文整理汇总了Java中rx.subjects.ReplaySubject.createWithTime方法的典型用法代码示例。如果您正苦于以下问题:Java ReplaySubject.createWithTime方法的具体用法?Java ReplaySubject.createWithTime怎么用?Java ReplaySubject.createWithTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rx.subjects.ReplaySubject
的用法示例。
在下文中一共展示了ReplaySubject.createWithTime方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testReplaySubjectLimit
import rx.subjects.ReplaySubject; //导入方法依赖的package包/类
public void testReplaySubjectLimit() throws Exception {
ReplaySubject<Integer> replaySubject =/* ReplaySubject.createWithSize(2);*/
ReplaySubject.createWithTime(150, TimeUnit.MICROSECONDS, Schedulers.immediate());
replaySubject.onNext(0);
Thread.sleep(100);
replaySubject.onNext(1);
Thread.sleep(100);
replaySubject.onNext(2);
replaySubject.subscribe(new SubAction("Later: "));
replaySubject.onNext(3);
}
示例2: RxBus
import rx.subjects.ReplaySubject; //导入方法依赖的package包/类
/**
* With this constructor the {@link RxBus} use a {@link ReplaySubject} and instantiate it calling the static method {@code ReplaySubject.createWithTime(retainTime, timeUnit, scheduler)}
* @see ReplaySubject
* @param retainTime events retain time, passed to {@link ReplaySubject}
* @param timeUnit events retain time unit, passed to {@link ReplaySubject}
* @param scheduler events retain time scheduler, passed to {@link ReplaySubject}
*/
public RxBus(int retainTime, TimeUnit timeUnit, Scheduler scheduler) {
super((Subject<T, R>) ReplaySubject.createWithTime(retainTime, timeUnit, scheduler));
mSubscriptionsList = new WeakHashMap<>();
}
示例3: HystrixCluster
import rx.subjects.ReplaySubject; //导入方法依赖的package包/类
/**
* Creates a new cluster
*
* @param name The name of the cluster
* @param maxTrafficTtlSeconds How many seconds back in the future we should consider max traffic
*/
public HystrixCluster(String name, int maxTrafficTtlSeconds)
{
this.name = name;
this.maxSubject = ReplaySubject.createWithTime(maxTrafficTtlSeconds, TimeUnit.SECONDS, Schedulers.computation());
}