On 11/23/10 1:56 AM, Sergey Beryozkin wrote:
Hi

I've found out, while working with CXF Continuations API recently is that

continuation.suspend()

is returning normally and no SuspendedInvocationException is thrown.

This is unexpected in that now, when continuation.suspend() is used directly
in the application code, the explicit 'return' has to be added.
This is not too bad when it is done immediately in the top-level service
object but if it happens in one of the sub-routines we are effectively have
no way of
knowing at the start of the call if it was suspended or not, unless we use
check the status explicitly :

Ex :

public void soapMethod() {
    doIt();

    if (!continuation.isPending()) {
        dontDoItIfSuspended();
    }
}

private void doIt() {
     continuation.suspend();
}

Willem - is it how the explicit continuations code has to be written now ?

Yes, that is what I want to do in CXF 2.3.0.
In this way we can implement suspend resume pattern[1] easily as Jetty 7 does.

The main reason that continuation.suspend() does not return immediately is letting the user have chance to setup the callback method for contination resuming. In this way we can make sure the continuation.resume() will never be called before the continuation.suspend.

thanks, Sergey

[1] http://wiki.eclipse.org/Jetty/Feature/Continuations#Suspend_Resume_Pattern

--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
         http://jnn.javaeye.com (Chinese)
Twitter: willemjiang

Reply via email to