You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Kohsuke Kawaguchi <kk...@kohsuke.org> on 2005/08/13 23:47:12 UTC
[javaflow] Continuation.startSuspendedWith(Runnable)
Torsten,
While implementing the workflow engine, I found that it's convenient to
be able to create a Continuation without actually executing it. This is
analogous to creating a thread in a suspended state.
While this can be easily emulated by wrapping the Runnable into the
following Runnable,
new Runnable() {
public void run() {
Continuation.suspend();
realTarget.run();
}
}
it's bit convenient and faster/easier to do so in the javaflow itself,
because all I need to do is:
return new Continuation(new StackRecorder(target));
In Win32 thread API one can create a thread in a suspended state, so at
some people seem to find that this is a generally useful feature. OTOH,
POSIX thread API doesn't have the equivalent AFAIK, nor
java.lang.Thread. So I'm not quite sure if this code should live in
javaflow or I should keep it on my side.
So I don't feel strongly either way, but if you are OK with putting this
change into javaflow, just because it's easier than the other approach.
--
Kohsuke Kawaguchi
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: [javaflow] Continuation.startSuspendedWith(Runnable)
Posted by Torsten Curdt <tc...@apache.org>.
On 13.08.2005, at 23:47, Kohsuke Kawaguchi wrote:
>
> Torsten,
>
> While implementing the workflow engine, I found that it's
> convenient to be able to create a Continuation without actually
> executing it. This is analogous to creating a thread in a suspended
> state.
>
> While this can be easily emulated by wrapping the Runnable into the
> following Runnable,
>
> new Runnable() {
> public void run() {
> Continuation.suspend();
> realTarget.run();
> }
> }
>
> it's bit convenient and faster/easier to do so in the javaflow
> itself, because all I need to do is:
>
> return new Continuation(new StackRecorder(target));
This definitely looks nicer.
But I am not sure. :-/
...can you please send me the diff
off-list?
cheers
--
Torsten