You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by "David Blevins (JIRA)" <ji...@apache.org> on 2009/11/01 00:17:59 UTC

[jira] Created: (OPENEJB-1099) Reentrant calls to Stateful beans

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.2, 3.1.1, 3.1
            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.


[jira] Updated: (OPENEJB-1099) Reentrant calls to Stateful beans unsupported

Posted by "David Blevins (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENEJB-1099?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David Blevins updated OPENEJB-1099:
-----------------------------------

          Summary: Reentrant calls to Stateful beans unsupported  (was: Reentrant calls to Stateful beans)
         Assignee: Thiago Veronezi
    Fix Version/s: 3.2-beta-1
                       (was: 3.1.3)

> Reentrant calls to Stateful beans unsupported
> ---------------------------------------------
>
>                 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
>            Assignee: Thiago Veronezi
>             Fix For: 3.2-beta-1
>
>         Attachments: OPENEJB-1099.patch
>
>
> 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.


[jira] Commented: (OPENEJB-1099) Reentrant calls to Stateful beans

Posted by "Thiago Veronezi (JIRA)" <ji...@apache.org>.
    [ 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.


[jira] Updated: (OPENEJB-1099) Reentrant calls to Stateful beans unsupported

Posted by "Thiago Veronezi (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENEJB-1099?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thiago Veronezi updated OPENEJB-1099:
-------------------------------------

    Attachment: OPENEJB-1099_v2.patch

Testing reentrancy.

> Reentrant calls to Stateful beans unsupported
> ---------------------------------------------
>
>                 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
>            Assignee: Thiago Veronezi
>             Fix For: 3.2-beta-1
>
>         Attachments: OPENEJB-1099.patch, OPENEJB-1099_v2.patch
>
>
> 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.


[jira] Commented: (OPENEJB-1099) Reentrant calls to Stateful beans

Posted by "Thiago Veronezi (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENEJB-1099?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12869448#action_12869448 ] 

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

Ill try that.
Is going to be a pleasure to help the team.
tkx.


> 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.


[jira] Commented: (OPENEJB-1099) Reentrant calls to Stateful beans

Posted by "Thiago Veronezi (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENEJB-1099?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12871983#action_12871983 ] 

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

Well... I think thats it.
Im changing the code shown above by this one below...

// ****************************************
        	final Class<?> beanCls = instance.bean.getClass();
        	final AccessTimeout accessTimeout = beanCls.getAnnotation(AccessTimeout.class);
        	
        	Lock currLock = instance.getLock();
        	final boolean lockAcquired;
        	if(accessTimeout == null) {
        		// returns immediately true if the lock is available 
        		lockAcquired = currLock.tryLock();
        	} else {
        		// AccessTimeout annotation found. 
        		// Trying to get the lock within the specified period. 
        		try {
					lockAcquired = currLock.tryLock(accessTimeout.value(), accessTimeout.unit());
				} catch (InterruptedException e) {
					throw new ApplicationException("Unable to get lock.", e);
				}
        	}
            // Did we acquire the lock to the current execution?
            if (!lockAcquired) {
            	 throw new ApplicationException(
            			 new ConcurrentAccessTimeoutException("Unable to get lock."));
            }

// ****************************************

Its not tested. Im trying to figure out how to create a unit test for it. Could you validate the solution above and say if it is what you were thinking? 

Another thing: Does make any sense to annotate stateful beans methods with AccessTimeout? I think thats only for Singleton, but Im not sure.

Thank you.

> 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.


[jira] Updated: (OPENEJB-1099) Reentrant calls to Stateful beans

Posted by "Thiago Veronezi (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENEJB-1099?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thiago Veronezi updated OPENEJB-1099:
-------------------------------------

    Attachment: OPENEJB-1099.patch

This is a possible solution for this issue. Please, codereview it.

> 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
>
>         Attachments: OPENEJB-1099.patch
>
>
> 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.


[jira] Commented: (OPENEJB-1099) Reentrant calls to Stateful beans

Posted by "David Blevins (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENEJB-1099?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12869313#action_12869313 ] 

David Blevins commented on OPENEJB-1099:
----------------------------------------

That's definitely the guilty if block.  There's some related EJB 3.1 functionality for this as well (@AccessTimeout)

What we should be doing is holding a ReentrantLock instead of a boolean.  And "isInUse()" should be a tryLock() call on the reentrant lock.  The new @AccessTimeout annotation basically allows users to specify how long they're willing to wait for the lock before getting an exception.  On that note, RemoteException is no longer the right exception.  There's a new ConcurrentAccessTimeoutException which should be thrown.

Interested in working on it?  We can use all the help we can get :)


> 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.


[jira] Commented: (OPENEJB-1099) Reentrant calls to Stateful beans

Posted by "Thiago Veronezi (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENEJB-1099?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12869285#action_12869285 ] 

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

I was checking the code and I was wondering if the fix for this bug wouldn't be just remove the attached highlighted "if". Could you please verify it for me?


> 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.