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