Return-Path: Delivered-To: apmail-commons-user-archive@www.apache.org Received: (qmail 90254 invoked from network); 4 Dec 2007 17:54:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Dec 2007 17:54:56 -0000 Received: (qmail 31623 invoked by uid 500); 4 Dec 2007 17:54:39 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 31565 invoked by uid 500); 4 Dec 2007 17:54:39 -0000 Mailing-List: contact user-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list user@commons.apache.org Received: (qmail 31556 invoked by uid 99); 4 Dec 2007 17:54:39 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Dec 2007 09:54:39 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: error (athena.apache.org: local policy) Received: from [81.169.146.160] (HELO mo-p00-ob.rzone.de) (81.169.146.160) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Dec 2007 17:54:18 +0000 X-RZG-CLASS-ID: mo00 X-RZG-AUTH: gSfJPH9qIU5ich7vHxkc9V5gTaVXJh1QhJRC6aupfJFEwGL6Rw5CaU07tg== Received: from [192.168.2.101] (pD9555495.dip.t-dialin.net [217.85.84.149]) by post.webmailer.de (mrclete mo58) (RZmta 14.5) with ESMTP id p03a63jB4FV5dR for ; Tue, 4 Dec 2007 18:53:58 +0100 (MET) (envelope-from: ) Mime-Version: 1.0 (Apple Message framework v752.3) In-Reply-To: References: <93375AA4-9D01-440D-AC1F-CCF3528E2905@sciss.de> <6762CE48-1A54-465A-B53B-EEE88C29A4BE@sciss.de> <38D9FE13-AEAD-4F93-8F14-16246D73F7D0@sciss.de> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: Sciss Subject: Re: [javaflow] Re: getting javaflow Date: Tue, 4 Dec 2007 18:53:54 +0100 To: "Jakarta Commons Users List" X-Mailer: Apple Mail (2.752.3) X-Virus-Checked: Checked by ClamAV on apache.org hello torsten, i have another question: how can i include objects other than primitives into the continuation storage? in this example: final Runnable r = new Runnable() { public void run() { final java.util.Random rnd = new java.util.Random(); int value = 500; int d; while( true ) { d = rnd.nextInt( 51 ) - 25; System.out.println( "val = " + value + "; d = " + d ); value += d; if( value < 0 ) { value += 1001; } else if( value > 1000 ) { value -= 1001; } Continuation.suspend(); } } }; final Continuation c = Continuation.startSuspendedWith( r ); Continuation d; System.out.println( "First run" ); d = c; for( int i = 0; i < 5; i++ ) d = Continuation.continueWith( d ); System.out.println( "Second run" ); d = c; for( int i = 0; i < 5; i++ ) d = Continuation.continueWith( d ); ... the output is something like: First run val = 500; d = 11 val = 511; d = 5 val = 516; d = -19 val = 497; d = 11 val = 508; d = 21 Second run val = 500; d = -25 val = 475; d = -6 val = 469; d = -15 val = 454; d = -11 val = 443; d = 9 so obviously 'value' got restored, but the random generator doesn't restore its seed. so can i make javaflow store the internal state of 'rnd', too? thanks, -sciss- Am 04.12.2007 um 16:04 schrieb Torsten Curdt: > Great! ...but still added the example to my TODO. > Javaflow needs some polishing anyway. > > cheers > -- > Torsten > > On 04.12.2007, at 14:51, Sciss wrote: > >> thank you torsten, >> >> putting my runnable in a dedicated package and using >> addLoaderPackageRoot("your.package.the.runnable.is.in") did it! >> >> now going back to experimentation ;-9 >> >> ciao, -sciss- >> >> >> Am 03.12.2007 um 12:23 schrieb Torsten Curdt: >> >>> Seems like I badly need to look into providing the tutorial >>> example to just run out of the box. >>> >>> On the first glance your try on the class loading seems a bit >>> unorthodox but should still work. (I never used the classloader >>> but always used javaflow through jci) ...but looking at the code >>> I'd assume you also need to tell the classloader what classes to >>> instrument. You might want to try >>> >>> addLoaderPackageRoot("your.package.the.runnable.is.in"); >>> >>> or set >>> >>> setParentFirst(false); >>> >>> Let me know if that helped. >>> >>> cheers >>> -- >>> Torsten >>> >>> -------------------------------------------------------------------- >>> - >>> 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 >> > > > --------------------------------------------------------------------- > 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