public ResponseData getResponseData(int partNum) throws ServerException, BadResumptionTokenException {
        if (m_exception != null) {
            throw m_exception;
        }

        // the current request should either be for the last sent part or plus one
        int nextPart = m_lastSentPart + 1;
        if (partNum == m_lastSentPart || partNum == nextPart) {

            // If the thread is still running and the last generated part was less than partNum,
            // wait till the thread is finished or the last generated part is greater or equal to partNum

            // Then, try to return the response
            while (m_threadWorking && m_lastGeneratedPart < partNum) {
                try { Thread.sleep(100); } catch (Exception e) { }
            }
        if (m_exception != null) {
            throw m_exception;
        }
            File partFile = new File(m_baseDir, m_sessionKey + "/" + partNum + ".xml");
            if (!partFile.exists()) {
                throw new BadResumptionTokenException("the indicated part does not exist");
            }
            String token = getResumptionToken(partNum + 1);
            ResponseData response = new ResponseDataImpl(new CachedContent(partFile), token);

            // Since we're going to succeed, make sure we clean up the previous part, if any
            if (partNum > 0) {
                int previousPart = partNum - 1;
                new File(m_baseDir, m_sessionKey + "/" + previousPart + ".xml").delete();
            }

            m_lastSentPart = partNum;
            m_expirationTime = new Date().getTime() + ( 1000 * m_secondsBetweenRequests );
            logger.info(m_sessionKey + " returning part " + partNum);
            return response;
        } else {
            throw new BadResumptionTokenException("the indicated part either doesn't exist yet or has expired");
        }
    }