RFR: 8319378: Spec for j.util.Timer::purge and j.util.Timer::cancel could be improved
Justin Lu
jlu at openjdk.org
Fri Nov 3 20:49:17 UTC 2023
Please review this PR which clarifies the definition of a _cancelled_ task in _j.util.Timer::purge_ and _j.util.Timer::cancel_.
Timer::purge claims that its return value is the number of tasks in the queue that were cancelled. This can be misleading, as a user can call Timer::cancel, thinking the rest of the tasks in the queue will be canceled (which should be the return value of Timer::purge).
In actuality, Timer::cancel _discards_ all of the tasks in the queue. For a task to have been _cancelled_, the task itself must have called TimerTask::cancel.
This change emphasizes the difference between _discarding_ and _cancelling_ a task.
Additionally, this change also includes a drive-by update to use an _apiNote_ and _implNote_ tag in the class description.
-------------
Commit messages:
- init
Changes: https://git.openjdk.org/jdk/pull/16503/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=16503&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8319378
Stats: 21 lines in 1 file changed: 7 ins; 2 del; 12 mod
Patch: https://git.openjdk.org/jdk/pull/16503.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/16503/head:pull/16503
PR: https://git.openjdk.org/jdk/pull/16503
More information about the core-libs-dev
mailing list