3 Replies Latest reply on Jan 26, 2007 10:00 AM by brian.stansberry

    ejb3 SFSB with load-balancing but without replication

    mindflyer

      Hi All

      I need to have SFSB with load-balancing but without replication. Theare are two cases:
      1) SFSB has references to not-serializable objects;
      2) SFSB is bridge to MBean, which starts to work in separated threads when client app sends first request and returns collected data in the next requests.
      I needn't fail-over.

      Can you help me? My first idea - turning of replication. But I don't know how to do it. Or may be does another solution exist?

      I use JBoss 4.0.5.GA

      Regards

        • 1. Re: ejb3 SFSB with load-balancing but without replication
          brian.stansberry

          You can set the CacheMode attribute in ejb3-clustered-sfsbcache-service.xml to LOCAL and that will disable replication. That will affect all EJB3 SFSBs though.

          The org.jboss.annotation.ejb3.cache.tree.CacheConfig annotation has a name attribute which allows you to specify the ObjectName of the JBoss Cache instance. You could set up a separate cache, similar to ejb3-clustered-sfsbcache-service.xml but with CacheMode LOCAL. Then use the CacheConfig annotation on your beans to specify the use of that cache.

          Haven't tried the 2nd paragraph, but should work.

          Hmm. You'd also need to remove the cache loader and the eviction configuration from the cache, or it will try to serialize your bean for passivation. You thus lose the ability to passivate your bean.

          It's also possible to do standard serialization tricks like making certain field transient, etc.

          • 2. Re: ejb3 SFSB with load-balancing but without replication
            mindflyer

            Thanks!

            I specified @CacheConfig.name for separate cache with CacheMode LOCAL and @Cache for my implementation of StatefulCache. It works.

            • 3. Re: ejb3 SFSB with load-balancing but without replication
              brian.stansberry

              Great! I appreciate your telling me it works; I thought it would but now I know. :-)