Giriş
Şu satırı dahil ederiz
import java.util.concurrent.ForkJoinTask;
To implement this divide and conquer strategy, Java provides 3 classes- ForkJoinTask- RecursiveAction- RecursiveTaskThe ForkJoinTask is the parent class of the RecursiveAction class and RecursiveTask class.
get metodu
Şöyle yaparız.
Şöyle yaparız.
ForkJoinPool pool = new ForkJoinPool(3);
ForkJoinTask<F.Promise<Void>> result = pool
.submit(() -> {
...
return F.Promise.<Void>pure(null);
});
try {
return result.get();
} catch (Exception e) {
throw new RuntimeException("Unable to get result", e);
}
Hiç yorum yok:
Yorum Gönder