FileDocCategorySizeDatePackage
GuidedLoopHandler.javaAPI DocExample630Thu Mar 11 19:50:46 GMT 2004javathreads.examples.ch15

GuidedLoopHandler

public class GuidedLoopHandler extends PoolLoopHandler

Fields Summary
protected int
minSize
Constructors Summary
public GuidedLoopHandler(int start, int end, int min, int threads)

        super(start, end, threads);
        minSize = min;
    
Methods Summary
protected synchronized LoopRangeloopGetRange()

        if (curLoop >= endLoop)
            return null;
        LoopRange ret = new LoopRange();
        ret.start = curLoop;
        int sizeLoop = (endLoop-curLoop)/numThreads;
        curLoop += (sizeLoop>minSize)?sizeLoop:minSize;
        ret.end = (curLoop<endLoop)?curLoop:endLoop;
        return ret;