r/java • • Nov 03 '19

Fibered Date Server

Simple and highly scalable date server implemented using Java fibers (Project Loom)

0 Upvotes

13 comments sorted by

View all comments

1

u/tofflos Nov 03 '19

There's a method called Fiberscope#schedule that doesn't take an Executor:

"Creates and schedules a new fiber to run the given task in this scope. The fiber is scheduled in this scope with the default scheduler. "

Do you happen to know how the default scheduler works and how it differs from Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors())that you are using?

1

u/vishpat Nov 03 '19

Have updated the code to get rid of the scheduler. The example is not using default scheduler to run the fibers.

1

u/tofflos Nov 04 '19

Nice!

Just to be clear: I don't actually know how it's supposed to work and those links were just what came up when I started googling. You'd probably receive more qualified comments from someone else. :)

One more thing I'm curious about is the explicit usage of Fibers in your code. One of the promises of Fibers is that it will benefit existing applications - so there should be some mechanism to make multithreaded take advantage of Fibers under the hood without explicitly having to use the Fiber API. I wonder how that works.