7 Replies Latest reply on Mar 27, 2008 4:49 AM by tfranconville

    TreeMap

    tfranconville

      What about TreeMap and Jboss cache

      I use JBoss 4.2.1 GA.
      I would like to share a TreeMap between node of a jboss cluster.
      What can I do to have that kind of use ?
      * an other version of Jboss Cache than the 1.4.1
      * doing an aop wrapper on treemap
      * using terracotta

      Here is the error that I obtain using the subMap method:

      Caused by: java.lang.RuntimeException: CollectionInterceptorUtil.invoke(): targetObject is null. Can
      't invoke public java.util.SortedMap AOPClassProxy$3.subMap(java.lang.Object,java.lang.Object)
       at org.jboss.cache.aop.collection.CollectionInterceptorUtil.invoke(CollectionInterceptorUtil.java:1
      36)
       at org.jboss.cache.aop.collection.CachedMapInterceptor.invoke(CachedMapInterceptor.java:117)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at AOPClassProxy$3.subMap(AOPClassProxy$3.java)
      


        • 1. Re: TreeMap
          jason.greene

          Unfortunately, TreeMap is not currently supported by POJO Cache. It is on the roadmap:

          http://jira.jboss.com/jira/browse/PCACHE-19

          The Core Cache API though is tree based, so you could just use it directly.

          • 2. Re: TreeMap
            genman

            TreeMap is sorted, whereas JBossCache is not.

            I came up with a patch which you might apply to order your nodes:
            http://jira.jboss.com/jira/browse/JBCACHE-841;jsessionid=2D6EAD361DAF7316E7C657BAAD922F5F

            • 3. Re: TreeMap
              genman

              Er, looks like that isn't much of a patch.

              But why don't you vote that issue and perhaps somebody will take a look?

              • 4. Re: TreeMap
                jason.greene

                 

                "tfranconville" wrote:
                Ok, so it is not possible actually to use TreeMap into pojoCache.
                But the pojocache inherits from treecache.
                Can I use put and get methods into PojoCache.
                I tried that. The use is strange.
                I have tested with 3 nodes, the 3 nodes view data put by only one node.
                If I stop the node from which we view data, we view data put by one of the 2 last nodes.
                If I stop the node from which we view data, we view data put by the last node.

                So, there is no data lost but there is not only one cache, or what ?

                I have probably miss something. Who can help me ?


                I am not sure I follow. Are you talking about TreeCacheAop? What version of POJO Cache/ JBoss Cache are you using?

                • 5. Re: TreeMap
                  tfranconville

                  I don't see, genman, what you want to do with a ConcurrentSkipListMap.

                  My needed is to share several TreeMap with different order between several Jboss cluster.

                  I am with Jboss 4.2.1 GA, so PojoCache 1.4

                  The use of TreeCache seems to be a better solution for me for those TreeMaps we cannot precise (several) order into TreeCacheAop.

                  • 6. Re: TreeMap
                    genman

                    Although TreeCache sounds like TreeMap, it does not provide node ordering.

                    ConcurrentSkipListMap would replace the ConcurrentHashMap object the default Node implementation and users could provide an ordering through that interface I included with the patch.

                    • 7. Re: TreeMap
                      tfranconville

                      You can put complex object like TreeMap into TreeCache node. This is the solution for me. it is slow at initialization and update, but it works.

                      About your solution, using Jdk1.6 and JBoss Cache 2.0 is a lot of big constraints for me.
                      Is it possible in your solution to change the order on subtrees ?