Continuable callstack outside a ContinuableObject?

View: New views
7 Messages — Rating Filter:   Alert me  

Continuable callstack outside a ContinuableObject?

by claas :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hello!
I have a problem with the Rife-Continuations in combination with
non-continuable objects.

I try to use the continuations to replace thread pools in an open source
multi agent system called Jadex. Continuations works so far, until i try to
make a loopback call from a non-continuable object to a continuable object
and then pause the continuation.

This is the (slightly modified) callstack:
TestClass.someMethod()    [e.g.  something like a executor or a test case]
  --> ContinuableRunner.start(ContinuableObject)
     --> ContinuableObject.execute()
             [pause continuation, set non-continuable object and resume
continuation]
        --> NonContinuableObject.someMethod()
           --> TestClass.loopbackTest()
              -->ContinuableObject.pauseContinuationMethod()
                 --> pause() [called in the pauseContinuation]

After the loopback-method, the pause() call in the ContinuableObject throws
an UnsupportedOperationException.

Also a simplified callstack doesn't work:
  TestClass.someMethod()
     --> ContinuableRunner.start(ContinuableObject)
        --> ContinuableObject.execute()
             [pause continuation, set non-continuable object and resume
continuation]
            --> NonContinuableObject.someMethod()
               --> ContinuableObject.loopbackTest()
                 --> pause() [called in the loopbackTest() method]

The second example only loops from the continuable object to the
non-continuable object,but the pause method throws the same exception.

In the attachement are two testcases and the needed classes. Hope this makes
my problem a little bit clearer. The testcases should work with the rife svn
tree.

Is it possible to implement such callstack with Rife-Continuations? And if
yes, can anybody tell me what i make wrong?

Testcases:
http://www.nabble.com/file/p18335150/testcases.tar.gz testcases.tar.gz
-- View this message in context:
http://www.nabble.com/Continuable-callstack-outside-a-ContinuableObject--tp18335150s9330p18335150.html 
Sent from the RIFE - users mailing list archive at Nabble.com.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "rife-users" group.
To post to this group, send email to rife-users@...
To unsubscribe from this group, send email to rife-users-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rife-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Continuable callstack outside a ContinuableObject?

by Geert Bevin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi Claas,

I haven't tried out your sample code yet, but it seems to me that the  
bytecode manipulation isn't happening for that pause() method, thus  
causing the UnsupportedOperationException to be thrown. This is most  
probably due to the ContinuableObject class not being loaded by the  
custom classloader. You'll have to verify that.

If at all possible for you, it might be easier to drop the custom  
classloader entirely and to use the Java 1.5 instrumentation agent.  
More information about this here: http://rifers.org/docs/api/com/uwyn/rife/continuations/instrument/ContinuationsAgent.html

Hope this helps,

Geert


On 08 Jul 2008, at 11:49, Claas Altschaffel wrote:

>
> Hello!
> I have a problem with the Rife-Continuations in combination with
> non-continuable objects.
>
> I try to use the continuations to replace thread pools in an open  
> source
> multi agent system called Jadex. Continuations works so far, until i  
> try to
> make a loopback call from a non-continuable object to a continuable  
> object
> and then pause the continuation.
>
> This is the (slightly modified) callstack:
> TestClass.someMethod()    [e.g.  something like a executor or a test  
> case]
>  --> ContinuableRunner.start(ContinuableObject)
>     --> ContinuableObject.execute()
>             [pause continuation, set non-continuable object and resume
> continuation]
>        --> NonContinuableObject.someMethod()
>           --> TestClass.loopbackTest()
>              -->ContinuableObject.pauseContinuationMethod()
>                 --> pause() [called in the pauseContinuation]
>
> After the loopback-method, the pause() call in the ContinuableObject  
> throws
> an UnsupportedOperationException.
>
> Also a simplified callstack doesn't work:
>  TestClass.someMethod()
>     --> ContinuableRunner.start(ContinuableObject)
>        --> ContinuableObject.execute()
>             [pause continuation, set non-continuable object and resume
> continuation]
>            --> NonContinuableObject.someMethod()
>               --> ContinuableObject.loopbackTest()
>                 --> pause() [called in the loopbackTest() method]
>
> The second example only loops from the continuable object to the
> non-continuable object,but the pause method throws the same exception.
>
> In the attachement are two testcases and the needed classes. Hope  
> this makes
> my problem a little bit clearer. The testcases should work with the  
> rife svn
> tree.
>
> Is it possible to implement such callstack with Rife-Continuations?  
> And if
> yes, can anybody tell me what i make wrong?
>
> Testcases:
> http://www.nabble.com/file/p18335150/testcases.tar.gz testcases.tar.gz
> -- View this message in context:
> http://www.nabble.com/Continuable-callstack-outside-a-ContinuableObject--tp18335150s9330p18335150.html
> Sent from the RIFE - users mailing list archive at Nabble.com.
>
>
> >

--
Geert Bevin
Terracotta - http://www.terracotta.org
Uwyn "Use what you need" - http://uwyn.com
RIFE Java application framework - http://rifers.org
Music and words - http://gbevin.com


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "rife-users" group.
To post to this group, send email to rife-users@...
To unsubscribe from this group, send email to rife-users-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rife-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Continuable callstack outside a ContinuableObject?

by claas :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Geert,

At this time I'm not able  to use  the  instrumentation agent due to some artifacts in Jadex which are not Java 1.5 compatible yet. But I will try to use the instrumentation agent for the testcases.

The UnsupportedOperationException is thrown from the pause() method and I agree that this is because the class isn't loaded from the continuation classloader at this time.

My problem is, that I don't understand why - and why only after the loopback / callback. Simply call pause and later resume the continuation without a type of cycle in the method-callstack works fine.

To make this clearer without going through my sample code here comes a (short) execution flow:

"-" are  steps in a class,
"->" or "<-" indicates a switch into another class or a switch back to the caller
"[...]" marks an explanation

    - create a runner
    -> start the continuable object via the runner
        <- the continuable object pause and execution resumes in the TestCase  [pause works here]
    - create a NON-continuable object (POJO)
    - get the continuable object through the ContinuationContext with the provided continuation-ID
    - call a setter method on the continuable object and set the NON-continuable in the continuable
    -> resume the continuation via the runner
       - the continuable object checks if the NON-continuable isn't null
       - the continuable object calls a method on the NON-continuable [parameter "this" or empty]
          - the NON-continuable object test the parameter
             [when "this" was provided by the continuable object "this" is used,
              else the continuable is accessed through the ContinuationContext ]
          [CYCLE / LOOP-BACK]
          -> the NON-continuable object calls a method on the continuable object
             [different from execute, say test() for now]
                - continuable objects test() method try to pause()


The last pause() call throws the UnsupportedOperationException, prior the cycle/loopback the pause() call works.
I tested this for a long time and I found no way to get this cycle/loopback works at all.

So my essential question is:
Is it possible to implement such a callback / loopback / cycle with Rife-Continuations or is this a use case that isn't supported/desired (yet)?

Hopeful,

Claas



Geert Bevin wrote:
Hi Claas,

I haven't tried out your sample code yet, but it seems to me that the  
bytecode manipulation isn't happening for that pause() method, thus  
causing the UnsupportedOperationException to be thrown. This is most  
probably due to the ContinuableObject class not being loaded by the  
custom classloader. You'll have to verify that.

If at all possible for you, it might be easier to drop the custom  
classloader entirely and to use the Java 1.5 instrumentation agent.  
More information about this here: http://rifers.org/docs/api/com/uwyn/rife/continuations/instrument/ContinuationsAgent.html

Hope this helps,

Geert


On 08 Jul 2008, at 11:49, Claas Altschaffel wrote:

  
Hello!
I have a problem with the Rife-Continuations in combination with
non-continuable objects.

I try to use the continuations to replace thread pools in an open  
source
multi agent system called Jadex. Continuations works so far, until i  
try to
make a loopback call from a non-continuable object to a continuable  
object
and then pause the continuation.

This is the (slightly modified) callstack:
TestClass.someMethod()    [e.g.  something like a executor or a test  
case]
 --> ContinuableRunner.start(ContinuableObject)
    --> ContinuableObject.execute()
            [pause continuation, set non-continuable object and resume
continuation]
       --> NonContinuableObject.someMethod()
          --> TestClass.loopbackTest()
             -->ContinuableObject.pauseContinuationMethod()
                --> pause() [called in the pauseContinuation]

After the loopback-method, the pause() call in the ContinuableObject  
throws
an UnsupportedOperationException.

Also a simplified callstack doesn't work:
 TestClass.someMethod()
    --> ContinuableRunner.start(ContinuableObject)
       --> ContinuableObject.execute()
            [pause continuation, set non-continuable object and resume
continuation]
           --> NonContinuableObject.someMethod()
              --> ContinuableObject.loopbackTest()
                --> pause() [called in the loopbackTest() method]

The second example only loops from the continuable object to the
non-continuable object,but the pause method throws the same exception.

In the attachement are two testcases and the needed classes. Hope  
this makes
my problem a little bit clearer. The testcases should work with the  
rife svn
tree.

Is it possible to implement such callstack with Rife-Continuations?  
And if
yes, can anybody tell me what i make wrong?

Testcases:
http://www.nabble.com/file/p18335150/testcases.tar.gz testcases.tar.gz
-- View this message in context: 
http://www.nabble.com/Continuable-callstack-outside-a-ContinuableObject--tp18335150s9330p18335150.html
Sent from the RIFE - users mailing list archive at Nabble.com.


    

--
Geert Bevin
Terracotta - http://www.terracotta.org
Uwyn "Use what you need" - http://uwyn.com
RIFE Java application framework - http://rifers.org
Music and words - http://gbevin.com



  

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "rife-users" group.
To post to this group, send email to rife-users@...
To unsubscribe from this group, send email to rife-users-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rife-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Continuable callstack outside a ContinuableObject?

by claas :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

claas wrote:
At this time I'm not able to use the instrumentation agent due to some
artifacts in Jadex which are not Java 1.5 compatible yet. But I will try
to use the instrumentation agent for the testcases.
I tried my testcases with the instrumentation agent and get the same result. First pause() call works fine but after the callback i get an UnsupportedOperationException.

Best Regards, Claas

Re: Continuable callstack outside a ContinuableObject?

by claas :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi again!

I played around with the continuations much more and simplified my testcases during testing.

It seems to me that I'm not able to pause() the continuation in an other method than the "execute" entry method. A pause() call in a sub-method is leading to a UnsupportedOperationException. The following sample code shows my problem.

--- code ---
public class SimpleSubTest extends ContinuableSupport implements ContinuableObject
{
        public Object clone() ...
       
        public void execute()
        {
                // works
                pause();
                sub();
        }

        public void sub()
        {
                // don't works, throws UnsupportedOperationException
                pause();
        }
}
--- code ---

Is this the desired behaviour?
Or did I have another problem?

Thanks in advance,
Claas

Re: Continuable callstack outside a ContinuableObject?

by Geert Bevin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Oooh, yeah, that's intended. Currently continuations are only  
supported in the 'entrance' method. I've been planning for a long time  
to support any method and also method call stacks, but currently this  
isn't possible yet.


On 09 Jul 2008, at 14:23, claas wrote:

>
>
> Hi again!
>
> I played around with the continuations much more and simplified my  
> testcases
> during testing.
>
> It seems to me that I'm not able to pause() the continuation in an  
> other
> method than the "execute" entry method. A pause() call in a sub-
> method is
> leading to a UnsupportedOperationException. The following sample  
> code shows
> my problem.
>
> --- code ---
> public class SimpleSubTest extends ContinuableSupport implements
> ContinuableObject
> {
> public Object clone() ...
>
> public void execute()
> {
> // works
> pause();
> sub();
> }
>
> public void sub()
> {
> // don't works, throws UnsupportedOperationException
> pause();
> }
> }
> --- code ---
>
> Is this the desired behaviour?
> Or did I have another problem?
>
> Thanks in advance,
> Claas
> --
> View this message in context: http://www.nabble.com/Continuable-callstack-outside-a-ContinuableObject--tp18335556s9330p18359768.html
> Sent from the RIFE - users mailing list archive at Nabble.com.
>
>
> >

--
Geert Bevin
Terracotta - http://www.terracotta.org
Uwyn "Use what you need" - http://uwyn.com
RIFE Java application framework - http://rifers.org
Music and words - http://gbevin.com


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "rife-users" group.
To post to this group, send email to rife-users@...
To unsubscribe from this group, send email to rife-users-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rife-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Continuable callstack outside a ContinuableObject?

by claas :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi Geert!

It's a pity about the the not supported method call stacks. It would be
so easy if this would work for our project.
IMHO javaflow does  support method call stacks in continuations, but
there some other problems. Currently there is no activity in the
javaflow project and it seems that there is no further development planned.

Do you think it would be possible for me to support method call stacks
in RIFE continuations? Maybe through rewriting some code from the
javaflow project? And what do you think about the amount of time or man
power needed for implementation?

Greetings,
Claas


Geert Bevin wrote:
> Oooh, yeah, that's intended. Currently continuations are only  
> supported in the 'entrance' method. I've been planning for a long
> time  to support any method and also method call stacks, but currently
> this  isn't possible yet.
>  

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "rife-users" group.
To post to this group, send email to rife-users@...
To unsubscribe from this group, send email to rife-users-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rife-users?hl=en
-~----------~----~----~----~------~----~------~--~---

LightInTheBox - Buy quality products at wholesale price
 
 
 
Google
rifers.org web