本文整理汇总了Java中rx.schedulers.Schedulers.from方法的典型用法代码示例。如果您正苦于以下问题:Java Schedulers.from方法的具体用法?Java Schedulers.from怎么用?Java Schedulers.from使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rx.schedulers.Schedulers
的用法示例。
在下文中一共展示了Schedulers.from方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: RxWrapperDocumentClientImpl
import rx.schedulers.Schedulers; //导入方法依赖的package包/类
public RxWrapperDocumentClientImpl(DocumentClient client) {
this.client = client;
int maxThreads = (int) (client.getConnectionPolicy().getMaxPoolSize() * 1.1);
this.executorService = new ThreadPoolExecutor(
Math.min(8, maxThreads), // core thread pool size
maxThreads, // maximum thread pool size
30, // time to wait before killing idle threads
TimeUnit.SECONDS,
new SynchronousQueue<>(),
new RxThreadFactory("RxDocdb-io"),
new ThreadPoolExecutor.CallerRunsPolicy());
this.scheduler = Schedulers.from(executorService);
}
示例2: setUp
import rx.schedulers.Schedulers; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
sharedPreferences =
RuntimeEnvironment.application.getSharedPreferences(SimpleUploadDataStore.JOB_REPO,
Context.MODE_PRIVATE);
final Scheduler worker = Schedulers.from(Executors.newSingleThreadExecutor());
dataStore = new SimpleUploadDataStore(sharedPreferences, worker);
gson = new GsonBuilder()
.registerTypeAdapterFactory(JobTypeAdapterFactory.create())
.create();
}
示例3: scheduler
import rx.schedulers.Schedulers; //导入方法依赖的package包/类
/**
* Specify the scheduler for CSApp to use for background work (e.g. syncing)
*
* @param executorService the executorService CSApp will use to sync and cache data.
*/
public Builder scheduler(ScheduledExecutorService executorService) {
this.scheduler = Schedulers.from(executorService);
return this;
}