[ 
https://issues.apache.org/jira/browse/OPENEJB-1099?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12869290#action_12869290
 ] 

Thiago Veronezi commented on OPENEJB-1099:
------------------------------------------

I didnt get my screenshoty attached, so Im going to show the code here.

org.apache.openejb.core.stateful.StatefulContainer

Between lines 692-699
            // Is the instance alreayd in use?
            if (instance.isInUse()) {
                // the bean is already being invoked; the only 
reentrant/concurrent operations allowed are Session synchronization callbacks
                Operation currentOperation = callContext.getCurrentOperation();
                if (currentOperation != Operation.AFTER_COMPLETION && 
currentOperation != Operation.BEFORE_COMPLETION) {
                    throw new ApplicationException(new 
RemoteException("Concurrent calls not allowed."));
                }
            } 

> Reentrant calls to Stateful beans
> ---------------------------------
>
>                 Key: OPENEJB-1099
>                 URL: https://issues.apache.org/jira/browse/OPENEJB-1099
>             Project: OpenEJB
>          Issue Type: Bug
>          Components: container system
>    Affects Versions: 3.1, 3.1.1, 3.1.2
>            Reporter: David Blevins
>             Fix For: 3.1.3
>
>
> A stateful bean should be able to invoke itself via its business interface. 
> The following code should work:
> @Stateful 
> public class MySessionBean implements MySessionBeanLocal { 
>   @Resource
>   private SessionConext context;
>   public void method1() { 
>     System.out.println("Method 1 invoked!"); 
>    context.getBusinessObject(mySessionBeanLocal.class).method2(); 
>   } 
>   public void method2() { 
>    System.out.println("Method 2 invoked!"); 
>   } 
> } 
> Currently this results in the following exception:
> I get a "Concurrent calls not allowed" exception:
> javax.ejb.EJBException: The bean encountered a non-application exception;
> nested exception is: 
>       javax.ejb.EJBException: Concurrent calls not allowed
>       at
> org.apache.openejb.core.ivm.BaseEjbProxyHandler.convertException(BaseEjbProxyHandler.java:358)
>       at
> org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:286)
>       at $Proxy117.method1(Unknown Source)
>       //....
> Caused by: javax.ejb.EJBException: Concurrent calls not allowed
>       at
> org.apache.openejb.core.ivm.BaseEjbProxyHandler.convertException(BaseEjbProxyHandler.java:358)
>       at
> org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:286)
>       at $Proxy117.Method2(Unknown Source)
>       //...
> Caused by: java.rmi.RemoteException: Concurrent calls not allowed
>       at
> org.apache.openejb.core.stateful.StatefulContainer.obtainInstance(StatefulContainer.java:635)
>       at
> org.apache.openejb.core.stateful.StatefulContainer.businessMethod(StatefulContainer.java:484)
>       at
> org.apache.openejb.core.stateful.StatefulContainer.invoke(StatefulContainer.java:274)
>       at
> org.apache.openejb.core.ivm.EjbObjectProxyHandler.businessMethod(EjbObjectProxyHandler.java:217)
>       at
> org.apache.openejb.core.ivm.EjbObjectProxyHandler._invoke(EjbObjectProxyHandler.java:77)
>       at
> org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:281)
>       ... 56 more

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to