[concurrency-interest] forkjoin.ParallelArray and friends

Doug Lea dl at cs.oswego.edu
Mon Aug 27 16:14:48 EDT 2007


As people who have been keeping track of the new fine-grained parallelism
framework might have noticed, we are firming up the aggregate operations
APIs. The main APIs surround class ParallelArray, which provides
apply, map, reduce, select, transform etc operations. For javadocs, see:
http://gee.cs.oswego.edu/dl/jsr166/dist/jsr166ydocs/jsr166y/forkjoin/ParallelArray.html

(And for jars, sources etc, see the usual places linked at
http://gee.cs.oswego.edu/dl/concurrency-interest/index.html)

While I expect a few minor changes will occur, unlike some previous
forms, these classes no longer say that they are standins for
functionality that will be developed. We think the APIs and
code are just about ready for routine (non-production) use,
and so invite you to uses them and report back any comments
and suggestions. (Now is your big chance before things become
too entrenched to change.)

Here's something pasted from javadocs that gives a feeling
for how you use ParallelArrays:

   import static Ops.*;
   class StudentStatistics {
     ParallelArray<Student> students = ...
     // ...
     public double getMaxSeniorGpa() {
       return students.withFilter(isSenior).withMapping(gpaField).max();
     }

     // helpers:
     static final class IsSenior implements Predicate<Student> {
       public boolean evaluate(Student s) { return s.credits > 90; }
     }
     static final IsSenior isSenior = new IsSenior();
     static final class GpaField implements MappertoDouble<Student> {
       public double map(Student s) { return s.gpa; }
     }
     static final GpaField gpaField = new GpaField();
   }



-Doug


More information about the Concurrency-interest mailing list