commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sainan Khan <personal.ca...@gmail.com>
Subject [javaflow] How to compare two continuations?
Date Wed, 18 Apr 2012 02:22:38 GMT
I’m a very newbie in javaflow. Consider the following basic example:
class MyRunnable implements Runnable {
  public void run() {
    System.out.println("started!");
    for( int i=0; i<10; i++ )
      echo(i);
  }
  private void echo(int x) {
    System.out.println(x);
    Continuation.suspend();
  }
}

Continuation c = Continuation.startWith(new MyRunnable());
Continuation d = Continuation.continueWith(c);
Continuation e = Continuation.continueWith(d);
Continuation f = Continuation.continueWith(d);
if (e.equals(f)) System.out.println("They are equal!");
else System.out.println("They are not equal!");


Both continuation e and f starts with same check point (d) and captures the
same stacks and also both of them print 1. Then still why “They are not
equal!”? (program gives this output). Can someone please explain it to me?

Thanks,
Sainan

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message