[concurrency-interest] ParallelArray classcastexception.

Rune Schjellerup Philosof rune at philosof.dk
Fri Mar 7 09:19:20 EST 2008


Hello all

How come this throws Exception in thread "Thread-5" 
java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [[F

        Scan[] scans;
        ForkJoinPool fjp = new ForkJoinPool();
        ParallelArray<Scan> scanarray = 
ParallelArray.createFromCopy(scans, fjp);
        ParallelArray<float[]> tmp = scanarray.withMapping(new 
Ops.Op<Scan, float[]>() {
            @Override
            public float[] op(Scan scan) {
                float[][] raw = scan.getSpectrum();
                return Spectrum.Resample(raw, _mzRange, 
_resamplingFrequency);
            }
        }).all();
        float[][] resampledSpectra = tmp.getArray();   <--- exception

where:
float[] org.fhcrc.cpl.viewer.feature.Spectrum.Resample(float[][] 
spectrum, FloatRange r, int resolution);

and scans contain an actual array and the resample method normally works.

--
Regards
Rune


More information about the Concurrency-interest mailing list