11 Replies Latest reply on Oct 10, 2005 4:27 AM by ben.wang

    TreeCacheAop, Maps and persistence

    motormind

      Hi there,

      Would it be possible to but a HashMap as the top-root in a TreeCacheAop and then see if entries are added, deleted or changed? I tried it but not much happens.

      I also don't get any persistence anymore. I simply use the same configuration-file that I used with the normal Treecache, only updated for the TreeCacheAop. Are there any special issues I shoud look out for?

        • 1. Re: TreeCacheAop, Maps and persistence

          Yes, it should be possibe. Here is the code snippet (you can read it more in docs.jboss.com).

          Map map = new HashMap();
          cache.putObject(fqn, map);
          // get the proxy
          Map proxy = cache.getObject(fqn);
          proxy.put(key, val); // Will show up in the cache store.

          For persistence, it should work as well.

          -Ben

          • 2. Re: TreeCacheAop, Maps and persistence
            motormind

            Weird. I thought that you could simply treat objects in the cache as if they were not stored.

            Anyway, now I do get this error message:

            java.lang.RuntimeException: InternalDelegate.incrementRefCount(): REF_COUNT for reference counting is null at: /feeds/12346/missions/0/scs/0/units/0

            I can't figure out what could cause this. Any insights?

            • 3. Re: TreeCacheAop, Maps and persistence
              brian.stansberry

               

              Weird. I thought that you could simply treat objects in the cache as if they were not stored.


              For every rule there is an exception ;-) In this case, we treat Map, List and Set specially; when such a collection is put into the cache the cache creates a proxy that implements the relevant interface. In the case of a collection that is an internal member of an object that is put in the cache, this is transparent to the user, but if you are storing the Map directly you need to get a reference to the proxy before you start operating on it.

              Not sure about your REF_COUNT issue; can you post more details (i.e. more of the stack trace, what your code was doing when it happened), or even better send me an e-mail with a small test case?

              • 4. Re: TreeCacheAop, Maps and persistence
                motormind

                Well, I sent you an email with the stacktrace. Could it be that maps and lists in the cache may not be null?

                • 5. Re: TreeCacheAop, Maps and persistence
                  brian.stansberry

                  It might be a couple days before I can look at this. If you post your stack trace to this forum thread, maybe someone else will spot something in the meantime :)

                  • 6. Re: TreeCacheAop, Maps and persistence
                    motormind

                    Okay, here comes:

                    java.lang.reflect.InvocationTargetException
                     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                     at java.lang.reflect.Method.invoke(Unknown Source)
                     at
                    org.jboss.cache.aop.CollectionInterceptorUtil.invoke(CollectionInterceptorUtil.java:100)
                     at
                    org.jboss.cache.aop.CachedMapInterceptor.invoke(CachedMapInterceptor.java:48)
                     at
                    org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:66)
                     at AOPClassProxy$0.put(AOPClassProxy$0.java)
                     at nl.mindef.c2sc.titaan.tbl.server.TblServerRmt.addCyrusMessage(Unknown
                    Source)
                     at
                    nl.mindef.c2sc.titaan.tbl.server.process.cyrusimport.CyrusImportProcess.distributeInternal(Unknown
                    Source)
                     at
                    nl.mindef.c2sc.titaan.tbl.server.process.cyrusimport.CyrusImportProcess.receivedMessage(Unknown
                    Source)
                     at
                    nl.mindef.c2sc.titaan.tbl.server.process.cyrusimport.CyrusImportProcess$CyrusListener.socketMessageReceived(Unknown
                    Source)
                     at nl.mindef.c2sc.titaan.tbl.server.communication.SocketHandler.run(Unknown
                    Source)
                     at java.lang.Thread.run(Unknown Source)
                    Caused by: org.jboss.util.NestedRuntimeException: TreeCacheAop.putObject(): ; -
                    nested throwable: (java.lang.RuntimeException:
                    InternalDelegate.incrementRefCount(): REF_COUNT for reference counting is null
                    at: /feeds/12346/missions/0/scs/0/units/0); - nested throwable:
                    (org.jboss.util.NestedRuntimeException: TreeCacheAop.putObject(): ; - nested
                    throwable: (java.lang.RuntimeException: InternalDelegate.incrementRefCount():
                    REF_COUNT for reference counting is null at:
                    /feeds/12346/missions/0/scs/0/units/0))
                     at org.jboss.cache.aop.CachedMapInterceptor.put(CachedMapInterceptor.java:79)
                     ... 14 moreCACHE: node removed: /feeds/12346/missions/0/scs/0/units/0
                    Caused by: org.jboss.util.NestedRuntimeException: TreeCacheAop.putObject(): ; -
                    nested throwable: (java.lang.RuntimeException:
                    InternalDelegate.incrementRefCount(): REF_COUNT for reference counting is null
                    at: /feeds/12346/missions/0/scs/0/units/0)
                     at org.jboss.cache.aop.TreeCacheAop.putObject(TreeCacheAop.java:270)
                     at org.jboss.cache.aop.CachedMapInterceptor.put(CachedMapInterceptor.java:77)
                     ... 14 more
                    Caused by: java.lang.RuntimeException: InternalDelegate.incrementRefCount():
                    REF_COUNT for reference counting is null at:
                    /feeds/12346/missions/0/scs/0/units/0
                     at
                    org.jboss.cache.aop.InternalDelegate.incrementRefCount(InternalDelegate.java:73)
                     at
                    org.jboss.cache.aop.TreeCacheAopDelegate.addRefFqn(TreeCacheAopDelegate.java:592)
                     at
                    org.jboss.cache.aop.TreeCacheAopDelegate.handleCircularReference(TreeCacheAopDelegate.java:464)
                     at
                    org.jboss.cache.aop.TreeCacheAopDelegate._putObject(TreeCacheAopDelegate.java:168)
                     at
                    org.jboss.cache.aop.TreeCacheAopDelegate._regularPutObject(TreeCacheAopDelegate.java:229)
                     at
                    org.jboss.cache.aop.TreeCacheAopDelegate._putObject(TreeCacheAopDelegate.java:175)
                     at
                    org.jboss.cache.aop.TreeCacheAopDelegate._collectionPutObject(TreeCacheAopDelegate.java:311)
                     at
                    org.jboss.cache.aop.TreeCacheAopDelegate._putObject(TreeCacheAopDelegate.java:182)
                     at
                    org.jboss.cache.aop.TreeCacheAopDelegate._regularPutObject(TreeCacheAopDelegate.java:229)
                     at
                    org.jboss.cache.aop.TreeCacheAopDelegate._putObject(TreeCacheAopDelegate.java:175)
                     at
                    org.jboss.cache.aop.TreeCacheAopDelegate._collectionPutObject(TreeCacheAopDelegate.java:311)
                     at
                    org.jboss.cache.aop.TreeCacheAopDelegate._putObject(TreeCacheAopDelegate.java:182)
                     at
                    org.jboss.cache.aop.TreeCacheAopDelegate._regularPutObject(TreeCacheAopDelegate.java:229)
                     at
                    org.jboss.cache.aop.TreeCacheAopDelegate._putObject(TreeCacheAopDelegate.java:175)
                     at
                    org.jboss.cache.aop.TreeCacheAopDelegate._collectionPutObject(TreeCacheAopDelegate.java:311)
                     at
                    org.jboss.cache.aop.TreeCacheAopDelegate._putObject(TreeCacheAopDelegate.java:182)
                     at
                    org.jboss.cache.aop.TreeCacheAopDelegate._regularPutObject(TreeCacheAopDelegate.java:229)
                     at
                    org.jboss.cache.aop.TreeCacheAopDelegate._putObject(TreeCacheAopDelegate.java:175)
                     at
                    org.jboss.cache.aop.TreeCacheAopDelegate._collectionPutObject(TreeCacheAopDelegate.java:311)
                     at
                    org.jboss.cache.aop.TreeCacheAopDelegate._putObject(TreeCacheAopDelegate.java:182)
                     at
                    org.jboss.cache.aop.TreeCacheAopDelegate._regularPutObject(TreeCacheAopDelegate.java:229)
                     at
                    org.jboss.cache.aop.TreeCacheAopDelegate._putObject(TreeCacheAopDelegate.java:175)
                     at org.jboss.cache.aop.TreeCacheAop._putObject(TreeCacheAop.java:376)
                     at org.jboss.cache.aop.TreeCacheAop.putObject(TreeCacheAop.java:255)
                    


                    • 7. Re: TreeCacheAop, Maps and persistence
                      brian.stansberry

                      Thanks! If someone else has a similar problem this may help them find the forum entry as well.

                      BTW, what version of JBossCache are you using?

                      • 8. Re: TreeCacheAop, Maps and persistence
                        motormind

                        I'm using version 1.2.3

                        • 9. Re: TreeCacheAop, Maps and persistence

                          1. Is this re-producible every time?

                          2. can you try out 1.2.4beta? It has a new object graph model.

                          Thanks,

                          -Ben

                          • 10. Re: TreeCacheAop, Maps and persistence
                            motormind

                            I tried the beta and problem seems to be solved tiah that one. The problem thouogh is that I am now allowed to use betas in development, let alone production.

                            • 11. Re: TreeCacheAop, Maps and persistence

                              Wait for 1.2.4 release then. It should come out next week or so.

                              -Ben