476 questions
0
votes
0
answers
86
views
Is there reason to use `ForkJoinPool/`Executors.newWorkStealingPool()` without implementing RecursiveAction/RecursiveTask?
In previous topic I've found out that my task is a good candidate for FJP/Executors.newWorkStealingPool()
Let me remind the code base(it is artificial code which demonstrated my real problem):
fun ...
1
vote
1
answer
67
views
How to chain mergeMap to get related objects
I'm having problems chaining mergeMap to retrieve related objects. First, I get a listing of users
userService.loadUsers$().pipe(
mergeMap((users: User[]) => forkJoin(users.map((user: IUser) =>...
0
votes
0
answers
63
views
How to disable one thread out of 3 using fork join_any and fork join_none
I have got an interview question.
We have 3 threads and only one thread should kill and other threads should complete using fork_join, join_any, join_none. How do you do that?
Generally using ...
0
votes
2
answers
98
views
forkJoin after APIs are completed - rxjs
So,I'm in kind of fix here. I've got 2 GET APIs. I need to do something once those APIs return success.
I did the following.
let sub1$ = this.myService.callFirstApi();
let sub2$ = this.myService....
1
vote
1
answer
64
views
Rxjs forkJoin operator doesn't emit anything
I have a problem using forkjoin.
I have three Angular services that take care of making an http call.
In each of these services there is an Observable, when the htttp request receives a response, the ...
0
votes
3
answers
83
views
Force nested loop over observables to wait for all
I've read about forkJoin, async, await, and also tried out angular life cycle methods, but finally found no good solution.
I need to wait until initiAttributesMap has finished his job before next code ...
0
votes
1
answer
94
views
Stackoverflow with Quicksort Java implementation using ForkJoin
I've been trying to do a quick sort using ForkJoin in Java and while in works for the most part, I get a stackoverflow when each element of the array is equal.
import java.util.Comparator;
import java....
1
vote
2
answers
373
views
Unexpected behavior Spring state machine JOIN
I'm testing some feature of Spring state machine (version 4.0.0). When I come across fork/join feature, the behavior of JOIN is somewhat strange to me (FORK is working as I expected). Any explanation ...
2
votes
1
answer
95
views
Subscribe Subject only after getting data from forkJoin
I want to pass some data from one module to another module. For that I am using Subject. I have created below subject :
import { Injectable } from '@angular/core';
import { Subject } from 'rxjs';
@...
2
votes
2
answers
553
views
Can I use "wait fork" to wait for threads spawned inside a task?
I'm experimenting with SystemVerilog threads, and I wrote the following example that works fine.
The goal is simply to spawn 2 tasks that print a number and wait for both of them using "wait fork&...
1
vote
1
answer
109
views
Explain why fork-join behaves differently when #10 begin A = 1'b0; B = 1'b1;end, and to #10; begin A = 1'b0; B = 1'b1; end [duplicate]
Please notice the semicolon after #10 delay in the second case.
I thought I understood fork-join, but after these outputs, I don't think I do. Can someone please explain why the semicolon is causing ...
-1
votes
1
answer
64
views
Unable to demonstrate performance gains of parallelism in Java using ForkJoin framework
I have a simple test program. It sums the values in an array of 10m entries using a sequential approach and a parallel approach.
Running on a chromebook, with 12 cores.
import java.util.Random;
import ...
0
votes
1
answer
88
views
java usage of parallelStream resulting into map
I have a single threaded code as follows :
private Map<Employee, EmployeeDeptMap> empToEmpDept(List<Employee> empList) {
Map<Employee, EmployeeDeptMap> map = new HashMap<>()...
0
votes
1
answer
45
views
Which rxjs operator to use to query many tables but the result exists in only one of the tables
We have five different tables, but the user exists only in one of them, we don't know which one it is, which operator is best to use to query all of them at the same time?
I'm using
forkJoin([...
1
vote
2
answers
229
views
forkjoin using javascript object or sourcesObject implementation
I have a piece of code that looks like this
getInformations().subscribe(
informations => {
let subs = [];
for (const information of informations) {
subs.push(...
0
votes
0
answers
69
views
Cant access request value when using valueChanges inside forkJoin()
I`m using simple forkJoin() like this:
const sources = [this.btApiClient.getAll(), this.buApiClient.getAll()];
forkJoin(sources)
.pipe(
map(([buildTypes, businessUnits]) => {
this....
0
votes
0
answers
241
views
Forkjoinpool behavior vs ExecutorService
We have a scenario to insert ~4M records into database. We receive these records in batches of 56 files, each containing ~80k records.
Used Forkjoinpool to insert the records in batches of 1000.
Once ...
-1
votes
2
answers
78
views
How to combine 2 Observable in angular app
I have a problem, how to combine 2 observable in a complicated case. I show you the code as follow:
so I have 2 Observables:
This 2 Observable will be used in canActivate(): Observable<boolean| ...
-1
votes
1
answer
282
views
forkJoin nor combineLatest from rxjs doesn't call api services
I'm trying to pass api calls inside the forkJoin or combineLatest then pipe them and finally map the results one by one to asign them values to the class level variables.
All the api calls return an ...
1
vote
2
answers
1k
views
Subscribe to multiple observables and emit value when each is completed
On my
ngOnInit()
I have this code:
combineLatest([ obs1, obs2, obs3]).subscribe(([obs1Res, Obs2Res, Obs3Res]) => { })
and the result is emitted once when they are completed.
Is there a way to emit ...
0
votes
1
answer
510
views
forkJoin get request value
I am trying to call multiple APIs using forkJoin. I believe the order in which the results will be return can be random. Is it possible to know which result belongs to which request?
Existing code:
...
1
vote
1
answer
53
views
ForkJoinFramework with AtomicLong is not giving consistent result
I'm trying to play with ForkJoinFramework. I know that my code might not be a good use case to use ForkJoin, but it should work at least..
I'm using RecursiveAction to concurrently modify a static ...
0
votes
2
answers
258
views
How can I add "Fork-join" to my file search code?
I wrote a program that searches for the necessary files in a directory and its subfolders based on the desired file size. But according to the assignment, I need to add a multithreaded "Fork-join&...
4
votes
1
answer
444
views
Parallel processes with dependency
There are two parallel processes. Each process has two steps. The second step of the first process is always executed after the first step. The second step of the second process is performed only ...
0
votes
0
answers
179
views
Using forkJoin with data service in Angular
I've seen all the example of using forkJoin with get requests, but all of them use the get directly in the forkJoin. Is it possible to pass in the data service function into the forkJoin? Currently, ...
5
votes
1
answer
975
views
In Loom, can I use virtual threads for Recursive[Action/Task]?
Is it possible to use RecursiveAction, for example, in conjunction with -- instead of the fork/join pool -- a pool of virtual threads (before I attempt a poorly-designed, custom effort)?
0
votes
1
answer
697
views
Fork and Join (Graph)
How would we describe the following graph like the example (with fork and join)?
In the example below why does the "count" start with 3?
2
votes
1
answer
721
views
Angular - Using mergeMap to fetch data from 2 APIs and saving them in an Array
Scenario : On ngOnInit, I need to call 3 APIs, Fork-Join them and save data in an array. 1st API is independent. 2nd is also independent but the 3rd one depends on response of the 2nd API.
I have not ...
0
votes
1
answer
322
views
How to use ForkJoin with Observables in Angular?
LogDataTransferService:
@Injectable({ providedIn: 'root' })
export class LogDataTransferService {
private logs = new Subject<SampleLogModel[]>();
public logs$ = this.logs.asObservable();
...
-1
votes
1
answer
703
views
How to use forkJoin and mergeMap in Angular resolver to chain HTTP requests?
I am building a resolver that is used when my app loads initially. I need to run several HTTP requests, which can be run at the same time (hence using forkJoin). But there are a few that need to be ...
0
votes
0
answers
200
views
fork(): Can't access to child process
I'm trying to make a program that creates 10 child processes by using fork().
By reading sem_overview I know that if fork():
returns 0 -> child process
return -1 -> error
return something >...
2
votes
1
answer
527
views
Sequential processing of multi-threaded results
I am setting up a Spring Boot application (DAO pattern with @Repositories) where I am attempting to write a @Service to asynchronously pull data from a database in multiple threads and merge-process ...
0
votes
1
answer
162
views
Simple multi-threaded Java app - ExecutorService? Fork/Join? Spliterators?
I am writing a command-line application in Java 8. There's a part that involves some computation, and I believe it could benefit from running in parallel using multiple threads. However, I have not ...
1
vote
1
answer
2k
views
rxjs.forkJoin ignore all success responses when one observable inside array fails, How to get info which observables were success?
I have dynamic array of []Observables, and I need to call them before finalize() API will be called, because then it will automatically lock the whole Object in DB for any modifications.
Issue is that ...
0
votes
1
answer
1k
views
Want to call multiple api calls in batch format using forkJoin in angular/Ionic
I have array of requests like:
let array = [req1,req2,req3.....,req(n)]
Currently I am using forkJoin to call a subscriber only after getting all requests response. Now I want to modify my code to ...
0
votes
1
answer
905
views
How does CombineLatest work compared to of
I'm learning about forkJoin. I'm trying to wrap my head around how it works compared to creating an observable with of. Please tell me if I have this right:
When I use of, it creates an observable ...
2
votes
2
answers
1k
views
Best way to pass parameter while using RxJS forkJoin
So, I have a service that has three functions that I need to execute.
I use forkJoin because I want to take further action when a response has been received for all!
One of them needs to receive one ...
1
vote
1
answer
777
views
Angular RXJS Make multiple http parallel calls after first request get done
After receiving the initial request response, I need to perform three parallel requests in my ngrx Effect.
I implemented the following, however when I inspect it using the network tab, all three ...
0
votes
0
answers
135
views
Source of forkjoin() not recognized as function
I'm using a ForkJoin to wait on 3 objects. Calling their getters inside the fork join seems not to work, giving the error seen below. The same method is called multiple times throughout the project, ...
0
votes
0
answers
73
views
ForkJoinTask:fork method execution
From Javadoc for ForkJoinTask::fork method:
Arranges to asynchronously execute this task in the pool the current
task is running in....
So when we invoke fork method on a ForkJoinTask, does it start ...
0
votes
1
answer
730
views
Get previous observable result to fork join pipe RXJS
First Http call to fetch Shipment Data
IF shipment data is NOT AVAILABLE exceution will be stop with showing error
IF shipment data is AVAILABLE i need to call second and third calls paralalley
I used ...
2
votes
2
answers
4k
views
How to use forkjoin to return combined responses of two independent API calls in Angular
I have two independent api calls. Below is the code for two api calls:
public getLendingType(partyId: string): Observable<{ lendingType: string, partyId: string }> {
return this....
6
votes
1
answer
18k
views
RxJs forkjoin deprecated [closed]
I have checked my project that forkjoin is being deprecated, since forkjoin is deprecated from angular what is the best option to use instead?
0
votes
1
answer
497
views
How to avoid api call if argument is null in forKJoin in angular 5?
this.hobbies :any[]=[];
this.worklist : any[]=[];
forkJoin(this.personService.addHobbies(this.hobbies),this.professionService.updateWorks(this.worklist))
.subscribe(res => {});
here i'm ...
1
vote
1
answer
1k
views
Angular subscription method with fork-join doesn't work
This my permission service. I wanna get a boolean array.
import { forkJoin, Observable } from "rxjs";
import { map } from 'rxjs/operators';
...
0
votes
0
answers
207
views
Angular getting A client-side or network error occurred: Cannot read properties of undefined (reading 'viewContainerRef')
I am using the following forkJoin to make preview call only for attachment that can be previewable. canPreview flag shows that.
But as soon as I add the filter, it is throwing the following error. I ...
0
votes
0
answers
41
views
NgRx - public variable loses it's value after forkJoin with Angular 8
I encountered a strange behaviour with forkJoin:
@Input() userId; // userId is now defined
forkJoin([
this.apiService.getUserProfile(this.userId), // userId is still defined
this....
-1
votes
2
answers
287
views
How to find longest words in all files using ForkJoin
Using the resources of the Fork-Join framework, create an asynchronous multithreaded system to form a collection of words of maximum length from three text files.
How to find the longest words in all ...
0
votes
0
answers
400
views
Array sum ForkJoin implementation slower than the serial implementation
So I am trying to understand how Java ForkJoin framework works. The simplest thing I could think of implementing was an array sum. However my parallel implementation is 3-4 times slower than the ...
2
votes
1
answer
2k
views
ForkJoinPool::shutdown vs ForkJoinPool::shutdownNow after ForkJoinPool::join
Code:
final ForkJoinPool forkJoinPool = new ForkJoinPool(PARALLELISM_NUMBER);
try {
final List<Record> records = getRecrods();
List<...