1 Reply Latest reply on Nov 13, 2007 10:25 AM by Brian Stansberry

    Stateless Session Bean Replication

    Mike Sauer Newbie

      I am looking for some details on stateful session bean state replication. What triggers state replication? Is the entire state replicated or is there a determination of what has changed and if so how is that done? I am trying to determine if there are any special programming considerations necessary for stateful session beans as there are with the replication of HttpSession state (where you have to make sure you call setAttribute again if you change anything that you pulled from the session). Thanks.

        • 1. Re: Stateless Session Bean Replication
          Brian Stansberry Master

          Replication is controlled by an interceptor added to the bean container. The replication happens when the invocation on the bean returns through the interceptor. The entire bean state is replicated. You can gain some control by adding a method

          public boolean isModified()


          to your bean. If there, the interceptor will check it and won't replicate if it returns false.

          For EJB3, to get that optimization, besides adding the method you have to make your bean implement interface org.jboss.ejb3.cache.Optimized (which simply declares the isModified() method.)