@Continuable
Lukas Stadler
lukas.stadler at jku.at
Mon Nov 23 07:03:53 PST 2009
Hi!
Rémi Forax wrote:
> Hi all, Hi Lukas,
> I've sucessfully used continuation with non blocking IO, this is
> really cool.
> see
> http://weblogs.java.net/blog/forax/archive/2009/11/22/nio-server-continuation-java
>
I'm very happy to hear that, thanks for putting this on your blog!
> But @Continuable seems odd for me.
>
> Why method need to be marked @Continuable ?
> What is the reason ?
> Is there a problem in the implementation that in order to be solved need
> to split method in two kinds, continuable or not ?
>
> Is it a security reason ?
There is an implementation issue that right now requires the annotation,
but removing it is the next thing on my list. So yes, its basically just
a security thing. Imagine for example a try-finally block: using generic
continuations I can execute the finally block twice, or not at all, ...
you get the picture. The programmer writing the method needs to be aware
of this.
But in the end I think we can loosen this requirement if we restrict the
implementation from continuations to coroutines. At the JVM Language
Summit it became clear that at least in the short run coroutines are
much more useful and much easier to get right. A coroutine will by
definition execute the finally block at most once, and if we make sure
that all coroutines end properly before terminating a thread we can even
make sure that it will be executed exactly once.
regards,
Lukas
More information about the mlvm-dev
mailing list