5 Replies Latest reply on Feb 24, 2011 6:01 AM by Galder Zamarreño

    Few questions about ISPN

    Amal Raj Vinoth James Newbie

      Hi all,

       

      1. is it possible to have multiple clustering modes in single config file, like replication and invalidation for a same cache.
      2. How do I dynamically reload the cache config.xml?
      3. How to print all node ip address of a cluster?.
      4. can you give me ex. of custom listener & custom interpretor? and where can i find the jar for listeners?
      5. how to enable/disable sync up between nodes at runtime?

       

      if possible, please give sample examples for above.

       

      thanks in advance.

       

       

      regards,

      amal

        • 1. Few questions about ISPN
          Galder Zamarreño Master

          Re 1. Not for the same cache. A config can contain N caches and each cache can only have one cluster mode.

           

          Re 2. No

           

          Re 3. Hmmm, not in an easy way. IIRC, EmbeddedCacheManager.getMembers will get you logical addresses. However, each node prints at INFO level their logical to physical (IP) address. What do you wanna use with this info exactly?

           

          Re 3. You should check the testsuite, there should be a few with those - https://github.com/infinispan/infinispan - Once you've written your interceptor/listeners, maybe you could add them as examples to the custom listener ( http://community.jboss.org/docs/DOC-14871 ) and custom interceptor ( http://community.jboss.org/docs/DOC-14852 ) wikise?

           

          Re 4. You can't switch from async to sync at runtime. But, you can configure your cache to be sync and then call getAsync/putAsync/...etc methods to get async calls. http://community.jboss.org/docs/DOC-14872

          • 2. Few questions about ISPN
            Galder Zamarreño Master

            Re 1. One more thing, even if a cache can only have one mode, using flags, you can make an operation stay local, even if the underlying cache is configured with distribution or replication...etc

            • 3. Re: Few questions about ISPN
              Amal Raj Vinoth James Newbie

              thanks for ur response.

               

               

              Galder Zamarreño wrote:

               

              Re 1. One more thing, even if a cache can only have one mode, using flags, you can make an operation stay local, even if the underlying cache is configured with distribution or replication...etc

              you mean using config.setMode("LOCAL");  will this work at runtime?

               

               

              1. No of threads maintainded in ISPN, is it per VM or per data structure?

                        when i try to check using Thread.getAllStackTraces().size(),  it gave me 22. is  it per data structure?.

                 2. In invalidation, when i clear node A, node B also gets clear, How is it done? are they sharing same cache?

               

              regards,

              amal.

              • 4. Re: Few questions about ISPN
                Galder Zamarreño Master

                Amal Raj Vinoth James wrote:

                 

                thanks for ur response.

                 

                 

                Galder Zamarreño wrote:

                 

                Re 1. One more thing, even if a cache can only have one mode, using flags, you can make an operation stay local, even if the underlying cache is configured with distribution or replication...etc

                you mean using config.setMode("LOCAL");  will this work at runtime?

                 

                No, you can change the config, but you can use flags to make cache operations local, i.e.

                 

                cache.withFlags(CACHE_MODE_LOCAL).put("k", "v");
                

                 

                The put will be local only regardless of whether the cache is configured with replication/distribution etc.... There's a bunch of other flags that can be used to tweak calls. We need a wiki on this...

                1. No of threads maintainded in ISPN, is it per VM or per data structure?

                          when i try to check using Thread.getAllStackTraces().size(),  it gave me 22. is  it per data structure?.

                 

                Infinispan maintains several threads to provide some functionality, i.e. replication queue...etc. Normally, the executors powering these are per cache manager.

                2. In invalidation, when i clear node A, node B also gets clear, How is it done? are they sharing same cache?

                 

                Well, when a key is invalidated in a cache, all caches in the cluster get that key removed as well. How is it done? See the code, uses JGroups to send rpcs.

                • 5. Re: Few questions about ISPN
                  Galder Zamarreño Master

                  Clearly, CACHE_MODE_LOCAL comes from org.infinispan.context.Flag enum, and withFlags() is a method of AdvancedCache, and you can get hold of advanced cache via: Cache.getAdvancedCache()