6 Replies Latest reply on Feb 8, 2012 6:45 AM by rhusar

    singleton ejb in the cluster

    morphy

      Hi...

       

      i did a @Singleton EJB with the TimerService @Resource, it is @Startup and on @PostConstruct it starts a tick (the timer is destroied on @PreDestroy)

       

      to perform this test i've used the JB AS 7.1.0.Alpha2 configured as full profile... servers in the groups are bound by ha-sockets, so it is a cluster...

       

      the timed tick happens in both cluster nodes, and this is not what i want... so:

       

      @Singleton EJBs are singleton per VM and not per cluster, i lack about spec knowledge about this topic... anyway, in previous JBoss releases i was used to add a dependency to ha-barrier and the timed object will be alive only in the master node

       

      how does  jboss as 7 address this scenario? how can i add something similar to the ha-barrier dependency?

       

      bye and thnx

        • 1. Re: singleton ejb in the cluster
          rhusar

          You might want to check this thread on AS7 dev:

           

          http://lists.jboss.org/pipermail/jboss-as7-dev/2011-December/004845.html

          • 2. Re: singleton ejb in the cluster
            morphy

            Hi Radoslav,

             

            i should avoid to promote JEE spec violations but... @Clustered is a JBoss specific annotation and... imho, this can create an acceptable exception...

             

            My purpose is to get a single timed object per cluster and i was able to do it in jb4 using the ha-barrier dependency... this dependency grants me high availability.... if @Clustered combined with @Singletion can grant this behavior... i think it could be a nice way if and only if it doesn't affect the spec for @Singleton

             

            thank you, i'll follow the thread in the mailing list

             

            bye

            • 3. Re: singleton ejb in the cluster
              wdfink

              From my point of view this will not be the only issue, and it is a problem from the beginning (for different (all) appserver).

              In AS7 all persistant timers are stored for each server in the filesystem.

              This mean there is no failover and load-balancing for timers, it will ever be started on that instance where it is created.

               

              So my dream is still to have persistent, clustered timers that fire only one event for the whole cluster

              • 4. Re: singleton ejb in the cluster
                rhusar

                So my dream is still to have persistent, clustered timers that fire only one event for the whole cluster

                Yeah, you need to create subsystem and SingletonService to deal with timers. Anyone could do that and contribute :-D

                • 5. Re: singleton ejb in the cluster
                  wdfink

                  Radoslav Husar wrote:

                  Yeah, you need to create subsystem and SingletonService to deal with timers. Anyone could do that and contribute :-D

                   

                  A Singleton is not what I mean, each instance should process timer events for a load balancing but they need to lock the timer event and recover if the processing server fails.

                  This will be a bit more complicated.

                  • 6. Re: singleton ejb in the cluster
                    rhusar

                    Right, the SingletonService would be used for synchronization/locking purposes.