I have a Runnable class that is sometimes started with a context object and sometimes without. When I call it without a context object, Continuation.getContext() throws a NullPointerException, although the documentation states it should just return a null value (which I think would be nice).

Is this a bug?

Here is a small example code:
----------
import org.apache.commons.javaflow.Continuation;

/**
 * The thread with some work that should be suspended
 */
class FlowRunnable2 implements Runnable {

    public void run () {
        System.out.println( "started!" );
        Object context = Continuation.getContext();


        if (context == null)
            System.out.println("context is null");

        for ( int i = 0; i < 500; i++ )
            echo( i );
    }

    private void echo ( int i ) {
        System.out.println( i );
    }

}

/**
 * Run the whole thing.
 *
 */
public class jafaflowTest2 {

    public static void main ( String[] args ) {
        FlowRunnable thread = new FlowRunnable();
        Continuation c = Continuation.startWith( new FlowRunnable() );

    }

}




Greetings,
Marcus


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to