• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
  • Carey Brown
  • salvin francis
  • Claude Moore

The ForkJoinTask: What is happening behind the scene?  RSS feed

Ranch Hand
Posts: 215
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Source of codes:  
Java 8 in Action: Lambdas, streams, and functional-style programming
(Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft) Page 217.

The ForkJoinSumCalculator class extended the ForkJoinTask class.  The line of code ForkJoinTask<Long> task = new ForkJoinSumCalculator(numbers); effectively creates a ForkJoinTask object from a ForkJoinSumCalculator class.  That means the instance named task does not have the fields and methods defined in the ForkJoinSumCalculator class. Example,
Long m = task.compute(); //Error: cannot find symbol. This confirms to me that the compute() method is not in task.
The thing is the program runs and produces a sum.  
So, I ask, what is going on behind the scene?
What is invoking the compute() method?
On which instance is the compute() method being invoked?
World domination requires a hollowed out volcano with good submarine access. Tiny ads are optional.
Create Edit Print & Convert PDF Using Free API with Java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!