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 boolean
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()
.void
run()
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
n
waves of attempts to fetch the grades with a delay ofx seconds
between 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:
run
in interfaceRunnable
- Specified by:
run
in classTimerTask
- Implementation Note:
- When restarting the
Friedolyn.countdown
, we usescheduleAtFixedRate
instead ofschedule
, because theFriedolyn.countdown
acts 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:
true
if the grades were fetched successfully,false
otherwise.- 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.
-