5 Replies Latest reply on Oct 12, 2009 6:54 AM by jaikiran

    "Application Scope" in EJB project?

      In my project, Application clients access a JBoss AS via RMI.
      Each client is assigned to a specific category, but only one client per category is allowed at the same time (so there may be mutliple clients connected to the AS simultaneously, but only one of each category).

      How do I implement this? In a non-EJB environment I'd use synchronized login/logout methods which manage a flag for each category. But both synchronization and an application-like scope are unavailable in EJBs, right?

      The obvious solution would be to have a database remember the login state and handle the concurrency issue. However, this seems a bit of an overkill and so far I do not need a database and I'd love to keep it like that.

      Any input would be greatly appreciated!

        • 1. Re:

          Hi!
          If the information on the categories is obsolete once the application is restarted, your could use a EJB 3.1 (or larger) Singleton Bean to mimic the database.

          Hope this helps,
          Georg

          • 2. Re:

            Hi Georg,

            Thank you very much for this tip. This seems to be exactly what I'm looking for!
            Is this supported in JBoss AS 5.1.0? If not, when will it be available?

            Best regards,
            Dennis

            • 3. Re:
              henk53

               

              "mwx.dennis" wrote:
              Hi Georg,

              Thank you very much for this tip. This seems to be exactly what I'm looking for!
              Is this supported in JBoss AS 5.1.0? If not, when will it be available?


              The Singleton beans G_Thimm refers to are not yet supported in JBoss AS 5.1, but I think they will be supported in JBoss AS 5.2, which will hopefully be released next week (beta 1).

              However, JBoss AS 5.1 does support something like this via the @Service annotation. See http://www.jboss.org/file-access/default/members/jbossejb3/freezone/docs/tutorial/1.0.7/html/Service_POJOs.html for details.


              • 4. Re:

                That's very good news - thanks!

                • 5. Re:
                  jaikiran

                   

                  "henk53" wrote:

                  The Singleton beans G_Thimm refers to are not yet supported in JBoss AS 5.1, but I think they will be supported in JBoss AS 5.2, which will hopefully be released next week (beta 1).

                  Just a FYI - http://www.jboss.org/index.html?module=bb&op=viewtopic&t=161843