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


Java ReplaySubject.createWithTime方法代碼示例

本文整理匯總了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);
}
 
開發者ID:yeungeek,項目名稱:Android-Gradle-Samples,代碼行數:12,代碼來源:SubjectTest.java

示例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<>();
}
 
開發者ID:SysdataSpA,項目名稱:UniversalEventBus,代碼行數:12,代碼來源:RxBus.java

示例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());
}
 
開發者ID:OskarKjellin,項目名稱:vizceral-hystrix,代碼行數:12,代碼來源:HystrixCluster.java


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