2 Replies Latest reply on Feb 2, 2010 3:04 AM by jaikiran pai

    @Serivce : Singelton EJB and reetrant calls

    Daniel Straub Newbie

      @Service means, there is only one instance of this EJB - ok.

      EJB Spec. 4.7.11 says, the container must ensure that only one thread can be executing an ejb-instance (non reentrant instances).

      If I use an @Service, does the container serials all calls to this EJB ? Or throws an javax.ejb.ConcurrentAccessEcxeption ?

        • 1. Re: @Serivce : Singelton EJB and reetrant calls
          Daniel Straub Newbie

          got the answer from the jboss developers via irc, thanks !

          • 2. Re: @Serivce : Singelton EJB and reetrant calls
            jaikiran pai Master

            dastraub wrote:

             

            got the answer from the jboss developers via irc, thanks !

            For the record - Here's what was discussed over IRC:

             

            (01:40:14 PM) danielst: @Service means, there is only one instance of this EJB, ok. EJB Spec. 4.7.11 says, the container must ensure that only one thread can be executing an ejb-instance (non reentrant instances). If I use an @Service, does the container serials the calls to this EJB ? Or throws an javax.ejb.ComcurrentAccessEcxeption ?
            (01:46:39 PM) Jaikiran: danielst: @Service is not the EJB3.1 @Singleton
            (01:46:48 PM) Jaikiran: @service was a jboss specific feature
            (01:47:45 PM) danielst: yes, I know - It's a JBoss extension. But how does this handle parallel calls to this ejb if there is only one instance ?
            (01:47:59 PM) wolfc: Jaikiran: in essence a service bean should behave very much like a singleton. Thread safety is one of the basics of EJB.
            (01:48:07 PM) wolfc: I'm not sure whether we actually guard for it though. :-)
            (01:48:25 PM) Jaikiran: wolfc: hehe, that's what i meant (i don't think we guard it) 
            (01:50:48 PM) danielst: thanks for this hints ;-) - I don't use this by my self, I have to review some other sources and looking for arguments ...
            (01:52:11 PM) Jaikiran: danielst: pretty soon we will be having @Singleton support, which will obviously be spec compliant
            (01:54:22 PM) You are now known as Jaikiran|Lunch
            (01:54:46 PM) danielst: @Singleton is EJB3.1, right ?
            (01:55:11 PM) Jaikiran|Lunch: danielst: yes
            (01:56:46 PM) danielst: yeah, I quickly read it now, there is also an @ConcurrencyManagement.
            (01:57:23 PM) Jaikiran|Lunch: yes allowing for bean managed/ container managed concurrency
            (02:01:23 PM) danielst: ok, as short summary : don't use the @Service because the behavior of concurrent calls is undefined ... and wait for ejb 3.1. Will the EJB 3.1 container works with an JBoss 4.2.3 (I guess not) ?
            (02:02:31 PM) Jaikiran|Lunch: EJb3.1 will be targeted against AS-6.0.x versions
            (02:02:57 PM) Jaikiran|Lunch: some of the initial features (like nointerface and deployment through .war) are available in the upcoming AS 6.0.0.M2
            (02:03:11 PM) Jaikiran|Lunch: btw, 4.2.3 isn't fully EJB3 compliant
            (02:04:22 PM) Jaikiran|Lunch: if you are interested in EJB3.1, here's its current state for 6.0.0.M2 http://community.jboss.org/wiki/EJB31inAS600M2