JDown/src/JDown/JDown.java
/*
     * Allocate job range for threads, job range can be glean from tracer if it exist;
     * */
Allocate job range for threads, job range can be glean from tracer if it exist.
Allocate job range for threads job range can be glean from tracer if it exist .
public void allocate(){
        log("Allocating jobs for [" + threadNum +"] threads...");
        long blockSize = fileSize / threadNum;
        long pos = 0, limit = 0;
        long[][] range = null;
        int threadID = 0;
        if (!isNew && !overWriteSign) {
            range = tracer.getRange();
        }
        for (int i = 0; i < threadNum; i++) {
            if (!isNew && !overWriteSign) {
                assert range != null;
                threadID = i;
                pos = range[i][0];
                limit = range[i][1];
            } else {
                threadID = i;
                pos = i * blockSize;
                limit = (i == threadNum - 1) ? fileSize-1 : pos + blockSize;
            }
            new JDownThread(threadID, url, pos, limit).start();
        }
    }
public void allocate ( ) { log ( "Allocating jobs for [" + threadNum + "] threads..." ) ; long blockSize = fileSize / threadNum ; long pos = 0 , limit = 0 ; long [ ] [ ] range = null ; int threadID = 0 ; if ( ! isNew && ! overWriteSign ) { range = tracer . getRange ( ) ; } for ( int i = 0 ; i < threadNum ; i ++ ) { if ( ! isNew && ! overWriteSign ) { assert range != null ; threadID = i ; pos = range [ i ] [ 0 ] ; limit = range [ i ] [ 1 ] ; } else { threadID = i ; pos = i * blockSize ; limit = ( i == threadNum - 1 ) ? fileSize - 1 : pos + blockSize ; } new JDownThread ( threadID , url , pos , limit ) . start ( ) ; } }
Allocate job range for threads, job range can be glean from tracer if it exist;
Allocate job range for threads job range can be glean from tracer if it exist ;