commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sciss <cont...@sciss.de>
Subject [javaflow] Re: getting javaflow
Date Sun, 02 Dec 2007 20:45:20 GMT
thank you wendy, un-commenting the <repository> elements in pom.xml  
helped.

now i get a runtime exception from running the tutorial example. i'm  
trying to use the dynamic method, having a regular class JavaflowTest  
and one MyRunnable that gets loaded with the special javaflow class  
loader:

// continuation test from the javaflow tutorial
import org.apache.commons.javaflow.*;

public class MyRunnable
{
	public MyRunnable()
	{
		Continuation d = Continuation.startWith(new 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();
			}
		});
		System.out.println("returned a continuation");
		while(d!=null) {
			d = Continuation.continueWith(d);
		}  	
    	}
}

// helper class to run the example
import org.apache.commons.javaflow.*;
import java.net.*;

public class JavaflowTest {
	public static void main( String[] args )
	{
	    try {
      	final ClassLoader cl = new ContinuationClassLoader(
            new URL[]{ new URL( "file://MyRunnable.jar" )},
            JavaflowTest.class.getClassLoader()); // parent class loader
          final Class clz = cl.loadClass( "MyRunnable" );
		 clz.newInstance();
		}
		catch( Exception e ) { e.printStackTrace(); }
	}
}

i'm preparing the URL class loader jar using

$ jar cvf MyRunnable.jar MyRunnable.class

and i run the test using

$ java -cp ../fromSVN/javaflow/trunk/target/javaflow-1.0- 
SNAPSHOT.jar:../fromSVN/javaflow/trunk/lib/bcel-5.2.jar:../commons- 
logging-1.1.1/commons-logging-1.1.1.jar:. JavaflowTest

but end up with

started!
0
1
2
3
4
5
6
7
8
9
02.12.2007 21:41:47  
org.apache.commons.javaflow.bytecode.StackRecorder execute
SCHWERWIEGEND: stack corruption. Is class MyRunnable$1 instrumented  
for javaflow?
java.lang.IllegalStateException: stack corruption. Is class MyRunnable 
$1 instrumented for javaflow?
         at org.apache.commons.javaflow.bytecode.StackRecorder.execute 
(StackRecorder.java:103)
         at org.apache.commons.javaflow.Continuation.continueWith 
(Continuation.java:171)
         at org.apache.commons.javaflow.Continuation.startWith 
(Continuation.java:130)
         at org.apache.commons.javaflow.Continuation.startWith 
(Continuation.java:103)
         at MyRunnable.<init>(MyRunnable.java:7)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0 
(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance 
(NativeConstructorAccessorImpl.java:39)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance 
(DelegatingConstructorAccessorImpl.java:27)
         at java.lang.reflect.Constructor.newInstance 
(Constructor.java:494)
         at java.lang.Class.newInstance0(Class.java:350)
         at java.lang.Class.newInstance(Class.java:303)
         at JavaflowTest.main(JavaflowTest.java:12)


thanks again for help! ciao, -sciss-



Am 02.12.2007 um 19:57 schrieb Wendy Smoak:

> On Dec 2, 2007 11:39 AM, Sciss <contact@sciss.de> wrote:
>
>> i'm trying to do the javaflow tutorial from http:// 
>> commons.apache.org/
>> sandbox/javaflow/tutorial.html , but i don't know how to download and
>> install javaflow. both
>>
>> http://vmgump.apache.org/gump/public-jars/commons-sandbox/jars/
>> http://people.apache.org/builds/jakarta-commons/nightly/
>>
>> don't have a .jar at hand. i did
>
> The only snapshots I can find are here, but they're really old...
> http://people.apache.org/repo/m1-snapshot-repository/commons- 
> javaflow/jars/
>
> (Also, please tag future subject lines with [javaflow] to help people
> sort messages.)
>
>> $ svn co http://svn.apache.org/repos/asf/commons/sandbox/javaflow
>>
>> , found that i need a build-tool called maven, downloaded maven,  
>> tried
>>
>> $ ~/Desktop/apache-maven-2.0.8/bin/mvn clean install
>>
>> but only get an error message
>
> Edit the javaflow/trunk/pom.xml file and un-comment the <repository>
> elements that you see there.  After that, it builds for me.
>
> Another option is to check out commons-sandbox-parent and build that
> locally with:
>   svn co http://svn.apache.org/repos/asf/commons/proper/commons- 
> sandbox-parent/trunk/
> commons-sandbox-parent
>   cd commons-sandbox-parent
>   mvn install
>
> HTH,
> -- 
> Wendy
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message