fork-join

Wait until two Observables are complete

我的未来我决定 提交于 2020-05-13 18:14:06
问题 I want to call a method after two Observables have returned values. I did some searching and it seems like forkJoin is what I want, but I can't get it to work. I know both of these Observables are returning values, as I am using the data for each individually elsewhere in the component, so clearly I'm doing something else wrong. Here is what I tried. I'm using rxjs v6.4. forkJoin( this.store.pipe(select(fromStore.getAppointmentsLoading)), this.clientStore.pipe(select(fromClientStore

Angular - RxJs ForkJoin How To Continue Multiple Requests Even After A Error

走远了吗. 提交于 2020-05-13 04:56:05
问题 I am querying a single API endpoint multiple times except with different parameters. For what ever reason some of these requests may fail and return a 500 error. If they do i still want the other requests to carry on and return me the data of all the successfull requests. let terms = []; terms.push(this.category.category); terms = terms.concat(this.category.interests.map((x) => x.category)); for (let i = 0; i < terms.length; i++) { const params = { term: terms[i], mode: 'ByInterest' }; const

Unexpected Scalability results in Java Fork-Join (Java 8)

廉价感情. 提交于 2020-01-13 03:33:11
问题 Recently, I was running some scalability experiments using Java Fork-Join. Here, I used the non-default ForkJoinPool constructor ForkJoinPool(int parallelism) , passing the desired parallelism (# workers) as constructor argument. Specifically, using the following piece of code: public static void main(String[] args) throws InterruptedException { ForkJoinPool pool = new ForkJoinPool(Integer.parseInt(args[0])); pool.invoke(new ParallelLoopTask()); } static class ParallelLoopTask extends

scala.concurrent.forkjoin.ForkJoinPool vs java.util.concurrent.ForkJoinPool

点点圈 提交于 2020-01-11 04:45:09
问题 Why ForkJoinPool was forked for Scala? Which implementation and for which case is preferred? 回答1: The obvious reason for the scala library to have its own copy of ForkJoinPool is that scala must run on pre-1.7 JVMs, and ForkJoinPool was only introduced in Java 1.7. In addition, there were a few changes made for internal (scala) use, such as this: https://github.com/scala/scala/commit/76e9da2ca4c31daec2b04848c3c2dbad6ecd426e Given that scala's version will probably not give you any advantage

Accessing data from 2 API simultaneously using ForkJoin : Not Defined error

痞子三分冷 提交于 2020-01-05 08:13:27
问题 Using ForkJoin I am trying to access data from 2 API https://sportsbook.draftkings.com/api/odds/v1/leagues/3/offers/gamelines.json https://www.fantasylabs.com/api/sportevents/3/2019_06_17 I am using forkjoin to access data of both data asynchronously. I am able to access homeTeamName, awayTeamName successfully, but while access lines i am getting error core.js:1521 ERROR ReferenceError: allline is not defined api.component.html <table class="table table-striped table-condensed table-hover">

How to handle nested HTTP requests in Angular 7?

本小妞迷上赌 提交于 2020-01-03 06:08:31
问题 I have a generic service for get data from server. When response received, I'm using a mapper function to map pure JSON data to required model. For some class type in mapper function, I need to get some additional data from server. How can I forcing mapper function wait for second request? This is my get function: getChildren(params: ITreeQueryParams): Observable<Optional<T[]>> { params.id = isPresent(params.id) ? params.id : 0; params.parentId = isPresent(params.parentId) ? params.parentId :

Strange output when using JMH

旧街凉风 提交于 2019-12-31 02:56:45
问题 I'm using jmh to benchmark a simple application (from SO question Unexpected Scalability results in java fork-join) using maven and following the command-line approach as advised in http://openjdk.java.net/projects/code-tools/jmh/. After successfully setting up and building the benchmark, I get the following benchmark results using the avgt mode: C:\Users\username\my-app\test>java -jar target/benchmarks.jar -bm avgt -f 1 # JMH 1.10.1 (released 13 days ago) # VM invoker: C:\Program Files\Java

Use fork-and-join in JDK6

拈花ヽ惹草 提交于 2019-12-29 00:41:31
问题 As I understand jdk7 has the support for fork-and-join, Can I use fork-and-join in JDK6 without upgraging to JDK7.0? 回答1: Yup, see here - the package you want is jsr166y. 来源: https://stackoverflow.com/questions/8205874/use-fork-and-join-in-jdk6

Use fork-and-join in JDK6

戏子无情 提交于 2019-12-29 00:41:08
问题 As I understand jdk7 has the support for fork-and-join, Can I use fork-and-join in JDK6 without upgraging to JDK7.0? 回答1: Yup, see here - the package you want is jsr166y. 来源: https://stackoverflow.com/questions/8205874/use-fork-and-join-in-jdk6

Using ThreadPoolTaskSupport as tasksupport for parallel collections in scala

只愿长相守 提交于 2019-12-25 04:21:52
问题 I have a List of 50-500 IO bound tasks, each of which may run from about 3 mins to 20 mins. The list is calculated before and no new tasks are added recursively. I want to run it all with fixed pool size(say 4). Tasks are not dependent on other tasks. So I guess this fits ThreadPoolTaskSupport usecase better than ForkJoinTaskSupport. But ThreadPoolTaskSupport is deprecated, and ForkJoinTaskSupport is only recommended alternative. I tried using ForkJoinTaskSupport, but it seems when last 8 or