1 Reply Latest reply on Feb 15, 2014 3:53 PM by Wolf-Dieter Fink

    @Clustered applied to @Stateless: needed or not?

    Juanjo Alvarez Newbie

      Hi.

       

      I can't find clear information about this topic. We are using EAP 6.2

       

      As far as I know @Clustered in @Stateful enterprise bean allow session data to be replicate and inform the available nodes to the ejb client.

       

      So, talking about @stateless:

      - Is it needed to add @Clustered to @Stateless in a HA environment since they have no session data?

       

      Extracted from (Clustering Changes in WildFly 8):

       

      The @Clustered annotation currently has 2 orthogonal meanings:

        1. If applied to a @Stateful EJB, then a specific cache will be used (as defined by the EJB subsystem)
        2. If applied to a @Stateless or @Stateful EJB, remote EJB clients will have a dynamic view of the EJB's topology.

       

      I thought that the dynamic view were informed always to the client regardless the annotation, but besides that in the client server accessing the ejb, the jboss-ejb-client.xml contains the reference to the  both servers that conform the cluster so the ejb client already knows the topology.

       

      So my question is:

           Which are the differences between use @Clustered or not in a @Stateless enterprise bean in a clustered environment? Is it really necessary?

       

      Thanks in advance

        • 1. Re: @Clustered applied to @Stateless: needed or not?
          Wolf-Dieter Fink Master

          Hello Juanjo,

           

          if you not mark a @Stateless as @Clustered the features are not enabled, that mean

          • if there is no other indicator for cluster the cluster modules (JGroups) are not started
          • if you access from remote the ejb-client context did not know about the cluster,
            i.e. only the server(s) in your client.property (or code) are used, but if clustered the server send a cluster-view back and all other servers in the cluster are used as well
          • the client continue with DeploymentNodeSelector instead of using the ClusterNodeSelector

           

          All this features are not available if you use Local interfaces or access the server with the remote-naming (URL remote://) approach.