Questions tagged [recursivetask]
12 questions
2
votes
1 answer
is the implementation of the Recursive Task below correct?
I am beginning to understand the implementation of the Recursive Task and Recursive Actions. Based on my understanding and some java documentation, I came up with the below code to add up all the numbers in an array.
I need help in correcting this…

Bharat Nanwani
- 653
- 4
- 11
- 27
2
votes
1 answer
2
votes
1 answer
Abstract class inheriting from RecursiveTask
I'm having problems to resolve an issue. First I have an abstract class inheriting from RecursiveTask:
public abstract class GeneratorTaskBase> extends RecursiveTask {
@Override
protected T compute() {
…

Rubén
- 427
- 1
- 9
- 23
1
vote
1 answer
Forkjoinpool VS sequential perofrmance
I am comparing sequential and parallel performance(using ForkJoinPool) of an algorithm(sum of first n numbers):
public class ForkJoinSumCalculator extends RecursiveTask {
private static final ForkJoinPool FORKJOINPOOL = new…

Mandroid
- 6,200
- 12
- 64
- 134
1
vote
1 answer
Error when trying to calculate (3*3)^2 using Recursive Task (Fork and Join) in Java
I have to use Java Recursive Task (Fork and Join) to calculate something like this: (3*3)^2.
I have this code which is supposed to work:
public class ForkJoin1 extends RecursiveTask {
int num;
public ForkJoin1 (int num) {
…
user10021033
1
vote
0 answers
RecursiveTask form Java 7 took greater time than expect
I am playing with RecursiveTask of the concurrent package from Java 7. It says this class has an implementation of forkJoin approach and can split my tasks in different threads. So I used a fibonacci example from the Java doc and compared the…

Felipe
- 7,013
- 8
- 44
- 102
0
votes
1 answer
The results differ with parallel summation in Java
I made class Sum extends RecursiveTask. The task is to calculate sum of 1 / a[i].
public class Sum extends RecursiveAction {
int[] items;
double result;
int min = 100000;
int from, to;
Sum(int[] items, int from, int to) {
…

GangYeah
- 1
- 1
0
votes
1 answer
WatchService large number of directory (recursive)
I want to detect changes inside a directory, so I implement by using WatchService
public class DirWatcher implements Runnable {
private Path path;
private ExecutorService exe;
public DirWatcher(Path path, ExecutorService exe) {
…

SoT
- 898
- 1
- 15
- 36
0
votes
1 answer
Why RecursiveTask implements Serializable in fork join?
I am planning to use Fork/Join in my application by extending the RecursiveTask class. I notice that it is Serializable. I have a few fields of non-serializable types that I want to keep in it. I could make them transient but that would make them…

Gurwinder Singh
- 38,557
- 6
- 51
- 76
0
votes
1 answer
RecursiveTask Throwing StackOverflowError While executing ForkJoin
I designed a RecursiveTask
Here is the code for task I designed.
public class SearchTask extends RecursiveTask> {
private static final long serialVersionUID = 1L;
private int majorDataThreshold = 16001;
private…

edwin
- 7,985
- 10
- 51
- 82
0
votes
0 answers
I would like to make my code more implementable for other applications
I would like to make my code more implementable for others applications.
I don't have problems with the code, it works perfectly. I would just like to rewrite it to use it in other contexts.
My original code:
import java.util.concurrent.*;
…

user3212453
- 11
- 1
- 6
0
votes
2 answers
Invoking more than 2 RecursiveActionTasks in compute()
What would be the drawback to invoke many RecursiveAction in the following code?
class RecursiveActionThing extends RecursiveAction
{
int numbers = 1000;
public RecursiveActionThing(int numbers)
{
this.numbers = numbers;
}
public void…

Rollerball
- 12,618
- 23
- 92
- 161