10 Replies Latest reply on Feb 26, 2010 6:20 AM by galder.zamarreno

    nodeCreated  is not called when cache is starting

      Hi,

      I am using AbstractTreeCacheListener to be notifed node creation. The nodeCreated method is successfully hitted at when a new record is added to my cache and my clustered server is up. However, when the second server is down and i start this redundant server and when cache started, the nodeCreated is not callled while loading records from cache. IS there any confuguration solution?

       

       

      Regards,

      Trustin

        • 1. Re: nodeCreated  is not called when cache is starting
          wjm

          Hi.  You need to <preload> to generate the appropriate creation events at startup time.

           


          {code:xml}

          <preload>

              <node fqn="/"/>  <!-- use as many nodes as you need, or this preloads everything -->
          </preload>

          {code}

           


          • 2. Re: nodeCreated  is not called when cache is starting

            thank you very much for comments.. I have applied below configuration.However, it doesnt work for me. My cache is loaded but I cant get notification for nodecretaed event...

             

             

            <loaders passivation="false" shared="true">
            <preload>
               <node fqn="/"/>
            </preload>
            </loaders>

            • 3. Re: nodeCreated  is not called when cache is starting
              wjm

              Hmm.  Well, it seems I may have chimed in a bit too soon.  AbstractTreeCacheListener isn't part of the newer JBC that I use.  Here I only need to implement the annotations and everything works fine.  However, you are adding the listener before creating/starting the cache, I presume?  If so, then I'm afraid I'm out of suggestions.

              • 4. Re: nodeCreated  is not called when cache is starting

                I am adding listener before creating our cache... I am also using Region for new cache stores..

                 

                Regards

                Trustin

                • 5. Re: nodeCreated  is not called when cache is starting
                  mircea.markus
                  What version of JBossCache are you using? Can you please also post the config and the listener registration code?
                  • 6. Re: nodeCreated  is not called when cache is starting

                    I have a similar problem. I have two servers both running the same application. The primary one is started first. It creates a cache and secondary also uses the same.

                     

                    When I put sth into cache of primary server (and both servers are up), I can see the data in the cache of secondary instance and it also hits the cache listener on the secondary server. I am making some other operations in the cache listener of secondary instance. Everything is ok in this scenario.

                     

                    Another scenario is that; secondary server is down and only primary is up. When I put sth into cache and then start secondary server, the data is again replicated to the secondary server but it is not hitting the cache listener so I cannot make operations in my cache listener. I need to do them for every data that is put into the cache.

                     

                    My JBoss Cache version is: 1.4.1.SP8

                     

                    my configuration is:

                     

                    <server>
                    <mbean code="org.jboss.cache.pojo.jmx.PojoCacheJmxWrapper" name="jboss.cache:service=PojoCache">
                      <depends>jboss:service=TransactionManager</depends>
                      <attribute name="TransactionManagerLookupClass">org.jboss.cache.GenericTransactionManagerLookup</attribute>

                      <attribute name="IsolationLevel">REPEATABLE_READ</attribute>
                      <attribute name="CacheMode">REPL_SYNC</attribute>
                      <attribute name="ClusterName">PojoNECacheCluster</attribute>   
                      <attribute name="FetchInMemoryState">true</attribute>
                      <attribute name="UseRegionBasedMarshalling">true</attribute>
                      <attribute name="InitialStateRetrievalTimeout">15000</attribute>
                      <attribute name="SyncReplTimeout">15000</attribute>
                      <attribute name="LockAcquisitionTimeout">10000</attribute>
                    </mbean>
                    </server>

                     

                     

                    And some more configuration on java code (because we need to decide IP, ports etc. on runtime) :

                     

                    //Generate Cluster configuration for Cache

                    StringBuilder sbCore =

                    new StringBuilder();

                    sbCore.append(

                    "TCP(bind_addr=");

                    sbCore.append(bindAddr);

                    sbCore.append(

                    ";end_port=");

                    sbCore.append(cachePort);

                    sbCore.append(

                    ";loopback=true;start_port=");

                    sbCore.append(cachePort);

                    sbCore.append(

                    "):TCPPING(initial_hosts=");

                    sbCore.append(peers);

                    sbCore.append(

                    ";num_initial_members=");

                    sbCore.append(num);

                    sbCore.append(

                    ";port_range=2;timeout=2000):MERGE2(max_interval=20000;min_interval=10000):FD(shun=true):FD_SOCK");

                    sbCore.append(

                    ":VERIFY_SUSPECT(timeout=1500):pbcast.NAKACK(gc_lag=50;max_xmit_size=8192;retransmit_timeout=600,1200,2400,4800)");

                    sbCore.append(

                    ":UNICAST(timeout=600,1200,2400,4800):pbcast.STABLE(desired_avg_gossip=400000)");

                    sbCore.append(

                    ":FC(max_credits=2000000;min_threshold=0.10):FRAG2(frag_size=8192)");

                    sbCore.append(

                    ":pbcast.GMS(join_retry_timeout=2000;join_timeout=5000;print_local_addr=true;shun=true):pbcast.STATE_TRANSFER");

                     

                    I need help.

                     

                    Thanks,

                    Avadula

                    • 7. Re: nodeCreated  is not called when cache is starting

                      any idea on the problem below?

                       

                      A workaround may be to get all the data in cache when the secondary application is up and do what ever needed in a for loop. But there may be a configuration to force that go through cache listeners.

                      • 8. Re: nodeCreated  is not called when cache is starting
                        mircea.markus
                        My JBoss Cache version is: 1.4.1.SP8

                        can you try a newer JBossCache version? Lates one is 3.2.3.GA.

                        • 9. Re: nodeCreated  is not called when cache is starting

                          Our JBoss version is 4.3.GA. Can we just update jboss cache version independent from the jboss version? Is 3.2.3.GA supported in our jboss distribution?

                           

                          I checked this link:

                          http://www.jboss.org/jbosscache/compatibility.html

                           

                          it seems to me like our jboss version is compatible with 1.4.x.

                          • 10. Re: nodeCreated  is not called when cache is starting
                            galder.zamarreno

                            In theory, it should be possible: http://community.jboss.org/wiki/JBossCache2xand3xandJBossAS4x

                             

                            Then again, we don't test this and hence we cannot guarantee that it works with a particular AS 4.x version.

                             

                            Bottom line: If u need JBoss Cache 3, move to JBoss AS 5, you'll be much better off