There is no magic in jetlang. It is just java. Code weaving tricks
make the problem harder than it needs to be.
Mike
> --
> You received this message because you are subscribed to the Google Groups
> "jetlang-dev" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/jetlang-dev/-/tDHJX_BvNHMJ.
> To post to this group, send email to jetla...@googlegroups.com.
> To unsubscribe from this group, send email to
> jetlang-dev...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/jetlang-dev?hl=en.
>
Yes, the term you're looking for is continuation aka coroutine. Java does
not have any (yet), so Scala/Kilim have to add their own stack
saving/switching mechanism. Kilim's is IMHO vastly superior since it adds
actual data safety guarantees. There is a working prototype for "proper"
built-in Java continuations about which you can read here (pdf at the
bottom): http://ssw.jku.at/Research/Papers/Stadler11Master/
> How does JetLang compare to this?
Jetlang does not implement any continuation mechanism, so a
hanging/looping fiber does just that. You will need to run each on a
different thread.
-h
Jetlang does not require a Thread per Fiber. You can create millions
of fibers if you'd like and use a backing thread pool for running
them. Jetlang guarantees the sequential execution of events for a
given fiber. Since it is java, it still requires discipline from the
developer. In practice, writing completely thread safe code with
Jetlang isn't difficult. Any framework that runs on the JVM
(including Kilim) cannot guarantee data safety since the JVM allows
threads. A developer can always spin up their own thread and access
shared data through a shared instance or a static reference. All
concurrency frameworks on the JVM merely make concurrency easier to
implement and understand, but cannot guarantee data safety.
--
You received this message because you are subscribed to the Google Groups "jetlang-dev" group.
To view this discussion on the web visit https://groups.google.com/d/msg/jetlang-dev/-/E9vpi9vrfAgJ.
That's true, wonderful, and also very specifically *not* what I wrote,
in the context of which I wrote it.
-h
"Jetlang does not implement any continuation mechanism, so a
hanging/looping fiber does just that. You will need to run each on a
different thread."
That is the statement I was referring to. To me, the statement implied
a dedicated thread is required for each and every fiber. A jetlang
fiber backed by a thread pool does not loop or hang. When inactive, it
does not consume resources by looping or polling. When an event
arrives that needs to be executed on that fiber, then the fiber is run
by the pool. The fiber is just an ordinary object on the heap.
In practice, pooled threads are rarely needed. Modern OS's are quite
efficient at thread scheduling so tens or hundreds of threads usually
aren't a problem. There are many cases when an app may need to
allocates a large number of fibers or have lots of short lived fibers,
so Jetlang provides the pooled implementation.
Obviously, in the absence of continuations, this is all made possible
by callbacks.
Mike