[concurrency-interest] jsr166y.forkjoin API comments

Joe Bowbeer joe.bowbeer at gmail.com
Mon Jan 28 17:31:27 EST 2008


On Jan 28, 2008 2:20 PM, Joe Bowbeer wrote:
> On Jan 28, 2008 12:15 PM, David J. Biesack wrote:
> >
> > As can be seen with the Matrix Multiplication example, sometimes you want fork/join
> > but you don't have an array to operate on; you just have a set of indices. In the example,
> > I create a ParallelArray but don't use it; the data already exists in double[][] arrays.
> > Hence the internal allocation of the Object[] array is wasted.
> >
> > [ ... ]
> >
> > I don't know if there is a solution other than adding a new create() method which defers
> > allocating the internal array until and only if it is needed (or maybe not at all, and it's a
> > programming error to use the wrong factory if you really wish to replace/generate values.
> >
>
> There is a createEmpty method.  Does it suffice?
>
> --Joe
>

On second thought, I'm fairly sure the answer is "no" -- though the
doc is a little fuzzy.  If no, I think a more descriptive name for
createEmpty would result in less confusion.

Rather than create a new create method to enable you to use PA's
control structure without using PA's data, however, I would rather
look for ways to enhance PA in order for it to solve this problem
directly.

--Joe


More information about the Concurrency-interest mailing list