-->
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.  [ 15 posts ] 
Author Message
 Post subject: TreeCache example
PostPosted: Tue Nov 22, 2005 5:39 pm 
Beginner
Beginner

Joined: Mon Oct 03, 2005 5:13 pm
Posts: 30
Hello all. I want to understand how to use this kind of feature. Anyone knows how using this in a desktop application, without running on JBoss? I´ll really appreciate.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 22, 2005 5:42 pm 
Beginner
Beginner

Joined: Tue Nov 22, 2005 4:53 pm
Posts: 41
Location: Netherlands
So you want to use distributed caching in a standalone application ?

Why?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 22, 2005 5:50 pm 
Beginner
Beginner

Joined: Mon Oct 03, 2005 5:13 pm
Posts: 30
Because I´m in this situation: one application reads a collection of elements and other inserts data. While I´m inserting new objects in database, I want to read them all at runtime, and this isn´t happening.

According with Hibernate in Action...."The first-level cache is mandatory and can’t be turned off". So, the EHCache isn´t the recommended to my needs.

Any hint?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 23, 2005 3:03 am 
Beginner
Beginner

Joined: Tue Nov 22, 2005 4:53 pm
Posts: 41
Location: Netherlands
You can try and take a look at JBoss Cache: http://www.jboss.org/products/jbosscache

You can use this as a stand-alone cache aswell. :)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 23, 2005 3:27 pm 
Beginner
Beginner

Joined: Mon Oct 03, 2005 5:13 pm
Posts: 30
Well, I´m on the right way. I´m trying to resolve this:

Code:
491265 [AWT-EventQueue-0] WARN org.jboss.cache.TreeCache  - No transaction manager lookup class has been defined. Transactions cannot be used


Using code:

Code:
Properties prop = new Properties();
         prop.put(Context.INITIAL_CONTEXT_FACTORY,
               "org.jboss.cache.transaction.DummyContextFactory");
         tx = (UserTransaction) new InitialContext(prop).lookup("UserTransaction");


or xml:

Code:
<attribute name="TransactionManagerLookupClass">org.jboss.cache.DummyTransactionManagerLookup</attribute>


But I can´t do that. I´m following a tutorial in jboss page, this: http://docs.jboss.org/jbcache/current/TreeCache/html/index.html#d0e205

Please help... :)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 23, 2005 4:08 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
you might also want to check out:
http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossCacheHibernate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 23, 2005 5:22 pm 
Beginner
Beginner

Joined: Mon Oct 03, 2005 5:13 pm
Posts: 30
Ok, thanks for the help, but the problem persists. :-P


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 23, 2005 5:54 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Um, well, if you're not going to be using JTA why exactly do you want to be using TreeCache (TreeCache, btw, = JBossCache)?

Why not just use EHCache?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 23, 2005 6:10 pm 
Beginner
Beginner

Joined: Mon Oct 03, 2005 5:13 pm
Posts: 30
I´m facing a problem:

One application inserts data and other reads, in differents JVM´s. I want, at runtime, to read all data while other application is inserting. This isn´t happening... Using TreeCache (from JBoss, yes), i´m trying to resolve this.

Any ideas?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 23, 2005 7:17 pm 
Beginner
Beginner

Joined: Tue Nov 22, 2005 4:53 pm
Posts: 41
Location: Netherlands
don't you just need another isolation level then, because I don't really get where you want to go with TreeCache and the description you give that the application should do...

Is it that, while inserting in application 1, while reading in application 2, you want the already read data from application 2 to be automaticly updated by the inserts from 1 ?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 24, 2005 7:36 pm 
Beginner
Beginner

Joined: Mon Oct 03, 2005 5:13 pm
Posts: 30
nomania, to syncronize data from the caching of more than one JVM, I have to use a distributed cache. I saw this in this article: http://www.informit.com/articles/article.asp?p=353736&seqNum=5. I´m trying to test this type of cache, I want to learn how to use this feature doing a Hello example, just to understand.

Thanks all for the help. Any sugestions?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 25, 2005 2:48 am 
Beginner
Beginner

Joined: Tue Nov 22, 2005 4:53 pm
Posts: 41
Location: Netherlands
bonoddr wrote:

But the article also only mentions using TreeCache at an application server.

This is a better link I think: http://docs.jboss.com/jbcache/1.2.4/tutorial/html/

Where has this code snippet:
Code:
TreeCache tree = new TreeCache();
PropertyConfigurator config = new PropertyConfigurator(); // configure tree cache. Needs to be in the classpath
config.configure(tree, "META-INF/replSync-service.xml");
tree.startService(); // kick start tree cache

Basicly this is the minimum code to start the TreeCache in the current JVM (that of your stand alone application) :)
So you have your onw TreeCache object, instead of having to look it up in the JNDI of a application server.

The rest is up to you, doing the configurations ;)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 25, 2005 7:52 am 
Beginner
Beginner

Joined: Mon Oct 03, 2005 5:13 pm
Posts: 30
Alright... I understood the basic steps of configuring the TreeCache... So I' ve to put all my objects I want in cache via code? Or this is something controlled by JTA?

Code:
tree.startService(); // kick start tree cache
tree.put("/a/b/c", "ben", "me"); // create a cache entry.
// Node "/a/b/c" will be created if not yet existed.


I'm still getting the same warning of
Code:
491265 [AWT-EventQueue-0] WARN org.jboss.cache.TreeCache  - No transaction manager lookup class has been defined. Transactions cannot be used


How can I define this transaction manager lookup class?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 25, 2005 1:34 pm 
Beginner
Beginner

Joined: Mon Oct 03, 2005 5:13 pm
Posts: 30
To perform a lookup, I´ve to register an object of type TreeCache as a SessionBean right? Im my case (desktop application), how can I do that? RMI? I´m still stuck on it...


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 25, 2005 4:44 pm 
Beginner
Beginner

Joined: Mon Oct 03, 2005 5:13 pm
Posts: 30
Solved!!! Thanks everybody!!! I saw the Dummy class and now I´m understanding.... :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 15 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.