在http://reactivex.io/RxJava/javadoc/io/reactivex/Observable中指出:
Observable的运算符默认情况下以128个元素的缓冲区大小运行(请参阅Flowable.bufferSize(),可以通过系统参数rx2.buffer-size全局覆盖。)
我的问题是,如何访问和设置rx2.buffer-size
?如果我这样做:
import io.reactivex.Completable;
import io.reactivex.Flowable;
import io.reactivex.Observable;
import io.reactivex.Scheduler;
import io.reactivex.Single;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.schedulers.Schedulers;
import io.reactivex.subjects.BehaviorSubject;
import io.reactivex.subjects.PublishSubject;
import io.reactivex.subjects.Subject;
import io.reactivex.*;
...之后:
Integer bufferSize = rx2.buffer-size;
Studio通知我:
import io.reactivex.*;
)如何覆盖系统参数rx2.buffer-size
?
我的项目正在使用
io.reactivex.rxjava2/rxandroid/2.0.1
io.reactivex.rxjava2/rxjava/2.1.11
答案 0 :(得分:3)
尝试:
Integer bufferSize = Integer.parseInt(System.getProperty("rx2.buffer-size"))
要设置新值:
System.setProperty("rx2.buffer-size", 2048)