private void waitForNextInvocation() throws ReplayParseException {
        if (_nextInvocation != null)
            return;

        while (!_done && _nextInvocation == null)
            Thread.yield();

        if (_nextInvocation == null) {
            try {
                close();
            } catch (ReplayRuntimeException rre) {
                if (_exception != null) {
                    rre.printStackTrace();
                    throw _exception;
                } else {
                    throw rre;
                }
            }
        }

        if (_exception != null)
            throw _exception;
    }