-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: TreeCache outside Hibernate
PostPosted: Mon Aug 16, 2004 1:55 pm 
Beginner
Beginner

Joined: Mon Aug 16, 2004 6:09 am
Posts: 46
Location: Geneva, Switzerland
As for now, hibernate uses it's own instance of TreeCache (created by TreeCacheProvider). I am using TreeCache as JMX component in JBoss and I'd like to make hibernate using shared TreeCache instance outside Hibernate itself.

What I did is just make my own version of net.sf.hibernate.cache.TreeCache, say, MyTreeCache where changed consructor code as following:

Code:
private static TreeCacheMBean cache;

    public TreeCache(String regionName, Properties props) throws CacheException {
        this.regionName = '/' + regionName.replace('.', '/');
        try {
            synchronized (TreeCache.class) {
                if (cache == null) {
                    cache = getCacheMBean();
                }
            }
        } catch (Exception e) {
            log.error("Error creating TreeCache.", e);
            throw new CacheException(e);
        }
    }

    public void destroy() throws CacheException {
//        cache.destroy(); no need to destroy anymore.
    }



Also I created version of TreeCacheProveder which instantiates MyTreeCache instead of TreeCache and put
<attribute name="CacheProviderClass">...MyTreeCacheProvider</attribute>
in hibernate-service.xml.

For me it seems to work perfect although I read somewhere in forum that for some reason TreeCache instance must be inside hibernate.

My question is: are there known issues with that configuration and if there are not, isn't it better way in light of Jboss-Hibernate integration? I mean configuring hibernate with just reference to external TreeCache MBean?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 16, 2004 4:53 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
this should be fine.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.