3 Replies Latest reply on Apr 15, 2011 1:33 AM by jaikiran pai

    JBoss @Service vs. EJB3.1 @Singleton

    david_b Newbie

      Hi all,


      I'm wondering what the practical differences are between a JBoss @Service bean and the new @Singleton beans in EJB3.1? I'm developing for JBoss AS 6, so both options are available.


      My current code base uses service beans for various tasks e.g. caching configuration parameters read from a database. It seems like Singleton beans were introduced to address precisely this type of problem.


      I'm at a point in the project where I'm refactoring the service beans, so I'm wondering if it's feasible to change them to the standards compliant Singleton beans. Are there any subtle differences that I need to know about?


      The only potential issue I can see is that they need to operate in a clustered environment i.e. singleton across the cluster, replicate state across the cluster. I've achieved this with service beans by deploying them as a high-availability service. I haven't seen much information on deploying singleton beans in this way but I assume the process is similar.


      Any insight would be appreciated.