Naming of schedule methods
Volkan Yazıcı
volkan.yazici at gmail.com
Wed Aug 28 07:14:55 UTC 2019
Hey Kasper,
I have raised the very same issue about API ergonomics back in February.
See Alan Bateman's comments:
https://mail.openjdk.java.net/pipermail/loom-dev/2019-February/000433.html
Best.
On Wed, 28 Aug 2019, 06:06 Kasper Nielsen <kasperni at gmail.com> wrote:
> Hi,
>
> I just downloaded the early access builds and started playing around with
> it.
>
> One initial thought. Am I the only one who was initially confused about the
> use of "schedule" as method names in both Fiber and FiberScope?
>
> Traditionally, members and classes that had 'schedule' in their name has
> always been about delayed or periodic execution of tasks.
> For classes, we have RunnableScheduledFuture, ScheduledFuture,
> ScheduledExecutorService in juc.
> For methods, we have them in Timer, TimerTasks,
> ScheduledExecutorService all named something with schedule.
>
> Outside of the JDK we have a @Schedule annotation in J2EE. In Spring we
> have
> TaskSchedule and another @Scheduled annotation. Similar in both Quarkus and
> Micronaut.
>
> In java.util.concurrent methods for "normal" scheduled execution are
> called either
> execute(), invoke() or submit(). Of which, submit() probably best matches
> what
> fibers are trying to do.
>
> I understand the intent, and schedule may be more "correct". But I do
> think it
> could cause some confusion. Also, if you try and combine the two, what
> would
> you call a method that schedules a fiber for delayed or periodic execution?
>
> /Kasper
>
More information about the loom-dev
mailing list