commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcus Deluigi <mdelu...@student.ethz.ch>
Subject Javaflow: Bug in Continuation.getContext();?
Date Wed, 02 Aug 2006 13:19:49 GMT
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: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message