commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Raji Sankar (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (SANDBOX-420) Javaflow has a problem when the suspended function is invoked using reflection
Date Thu, 14 Jun 2012 10:01:43 GMT

    [ https://issues.apache.org/jira/browse/SANDBOX-420?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13294937#comment-13294937
] 

Raji Sankar commented on SANDBOX-420:
-------------------------------------

java.lang.Method cannot be BCI'ed since this is a system class. But, if I do not continue
the Method.invoke, but re-invoke it passing to it the same parameters as previous, then the
calling class by virtue of having a state should technically continue from where it left off.

A partial fix which I have added it has worked (it only works where Class, method and parameters
passed to it are all local variables): 
- I have changed ContinuationMethodAnalyzer to read the variables for the Method.invoke call
- Push in ContinuationMethodAdapter calls push for the method object and the method.invoke
reference when the state is saved of the class calling Method.invoke
- the pop pops all the references and hence the method reference, so no changes here, just
a change to the parameters, it pops the local variables instead of null parameters.
- happens only if the method is annotated with ContinueReflection 
                
> Javaflow has a problem when the suspended function is invoked using reflection
> ------------------------------------------------------------------------------
>
>                 Key: SANDBOX-420
>                 URL: https://issues.apache.org/jira/browse/SANDBOX-420
>             Project: Commons Sandbox
>          Issue Type: Bug
>          Components: Javaflow
>    Affects Versions: CSV 1.0
>         Environment: Debian linux using Sun JDK 1.6 and asm 4.0_RC2
>            Reporter: Raji Sankar
>            Priority: Minor
>         Attachments: ContinuationMethodAdapter.java, ContinuationMethodAnalyzer.java,
ContinueReflection.java
>
>
>  I have a fn which has a code as below:
> private void callsomeshared()
>         throws Exception
> {
>         Method mthd = _someShared.getDeclaredMethod("doSomething");
>         int cnt = 0;
>         while (cnt < 10)
>         {
>             mthd.invoke(_shared);
>             //Continuation.suspend();
>             cnt++;
>         }
> }
> The doSomething does this:
>     public boolean doSomething()
>         throws Exception
>     {
>         if (_shared.value() < 10)
>         {
>             _shared.echo();
>             Continuation.suspend();
>         }
>         return (_shared.value() < 10);
>     }
> Doing this, fails with a ClassCastException, since when it hits the Method.invoke, it
is potentially popping out the AnotherLoader class and does not have the Method class pushed.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message