Naming of schedule methods

Kasper Nielsen kasperni at gmail.com
Wed Aug 28 04:05:23 UTC 2019


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