Package page.codeberg.friedolyn
Class Friedolyn.FetchGradesTask
java.lang.Object
java.util.TimerTask
page.codeberg.friedolyn.Friedolyn.FetchGradesTask
- All Implemented Interfaces:
Runnable
- Enclosing class:
Friedolyn
Fetches the student's grades from the University of Jena's Friedolin system by calling the
Friedolyn.fetchGrades().- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate booleanAttempts to fetch the student's grades from the University of Jena's Friedolin system two times with a delay of 5 seconds between each attempt, by calling theFriedolyn.fetchGrades().voidrun()Fetches the student's grades from the University of Jena's Friedolin system by calling theFriedolyn.fetchGrades().Methods inherited from class java.util.TimerTask
cancel, scheduledExecutionTime
-
Constructor Details
-
FetchGradesTask
public FetchGradesTask()
-
-
Method Details
-
run
public void run()Fetches the student's grades from the University of Jena's Friedolin system by calling theFriedolyn.fetchGrades(). Resets thecountdown.Will make
nwaves of attempts to fetch the grades with a delay ofx secondsbetween two waves.
Each wave consists of two distinct attempts with a delay of 5 seconds between each attempt. Will return early if possible.- Specified by:
runin interfaceRunnable- Specified by:
runin classTimerTask- Implementation Note:
- When restarting the
Friedolyn.countdown, we usescheduleAtFixedRateinstead ofschedule, because theFriedolyn.countdownacts as a clock that should not be influenced by the time it takes to execute therun()method. In other words, no countdown decrement should delay the next countdown decrement.
-
attemptFetchingGrades
private boolean attemptFetchingGrades()Attempts to fetch the student's grades from the University of Jena's Friedolin system two times with a delay of 5 seconds between each attempt, by calling theFriedolyn.fetchGrades(). Will return early if possible.- Returns:
trueif the grades were fetched successfully,falseotherwise.- Implementation Note:
- We use a
for-loop instead of simply callingFriedolyn.fetchGrades()twice, in order to make the amount of attempts easier to re-configure in the future.
-