本文整理匯總了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());
}