It's UWAweek 26 (mid-year break)

help2005

This forum is provided to promote discussion amongst students enrolled in CITS2005 Object Oriented Programming.

Please consider offering answers and suggestions to help other students! And if you fix a problem by following a suggestion here, it would be great if other interested students could see a short "Great, fixed it!"  followup message.

How do I ask a good question?
Displaying selected article
Showing 1 of 257 articles.
Currently 9 other people reading this forum.


 UWA week 20 (1st semester, week 11) ↓
SVG not supported

Login to reply

👍?
helpful
2:41pm Wed 15th May, Andrew G.

"Zhengze Shen" [email protected] wrote:

Hello,

Does an instance of the class StudentListIterator receive so many retries in total or is the number of retries simply for each getPage() operation? (say, 200 pages, each getPage() requires 3 retries, and if we iterate through all 200 pages, then the total number of retries is 600?)

I think your wording is a little unclear, so I am not 100% sure I understand what you are asking. I believe you are asking whether the specified number of retries is for the whole lifetime of the StudentListIterator, or for each attempt to call getPage().

I will draw your attention to the documentation on the StudentListIterator class that says:

    /**
     * Construct an iterator over the given {@link StudentList} with the specified retry quota.
     *
     * @param list The API interface.
     * @param retries The number of times to retry a query after getting {@link
     *     QueryTimedOutException} before declaring the API unreachable and throwing an {@link
     *     ApiUnreachableException}.
     */
    public StudentListIterator(StudentList list, int retries) {
        // TASK(8): Implement StudentListIterator
    }

retries is "The number of times to retry a query after getting QueryTimedOutException before declaring the API unreachable and throwing an ApiUnreachableException."

Additionally, the instructions say "Since calls to getPage() may fail with a QueryTimedOutException, your implementation should retry the connection in case it was just a momentary failure. A retry quota is given when constructing the iterator. If the API is still not reachable after exceeding the retry quota, you should raise an ApiUnreachableException."

Of note is that we specify that it should "retry a query", and that we are looking to handle a momentary failure.

As such, I think it is clear that you should throw an ApiUnreachableException only after getting retries timeouts while trying to perform a single query.

This is also clear from the tests. In particular, testRetries() ensures that your solution does not throw an ApiUnreachableException even though it receives many scattered QueryTimedOutExceptions, but when receiving too many QueryTimedOutExceptions in a row, it does throw an ApiUnreachableException.

I hope that has clarified the issue for you.

Gozz

The University of Western Australia

Computer Science and Software Engineering

CRICOS Code: 00126G
Written by [email protected]
Powered by history
Feedback always welcome - it makes our software better!
Last modified  5:07AM Sep 06 2023
Privacy policy