[jboss-user] [JBoss Cache: Core Edition] - Re: BerkeleyDB Deadlock Exception from JBoss Cache Loader: B

galder.zamarreno@jboss.com do-not-reply at jboss.com
Tue Jun 30 03:04:49 EDT 2009

"niuxuetao_fiserv" wrote : About the write-intensive stuff, yes, we will have a lot more calls to attach() than modifying the already cached Pojos. 

Attaching a pojo is an expensive operation where the pojo is dissected and mapped to the cache, hence such operation should be used as less as possible. Detailed information on the process can be found in http://www.jboss.org/file-access/default/members/jbosscache/freezone/docs/3.0.0.GA/pojo/userguide_en/html_single/index.html#d0e763

If you're calling attach more often than modifying the Pojo directly, I'm not sure of the suitability of PojoCache in your case. It might even be more of a burden than using plain JBoss Cache. The point of a PojoCache is that you attach once and then you interact with the bean as normal, calling it's getters,setters...etc and when you're done with it, you detach it.

"niuxuetao_fiserv" wrote : 1. If I call attach() with a key and value that already exist in the cache, what will happen?

Hmmm, do you mean what happens when you attach a pojo under a fqn+key that already contains a pojo? In that case, the existing pojo is detached and the new one is reattached. Due to the reasons above, this is an expensive operation.

"niuxuetao_fiserv" wrote : 2. How do I use transaction in java code to explicitly begin and end a transaction? 
  | - DummyTransactionManager.getUserTransaction()?
  | - or like describe in this page? http://www.jboss.org/file-access/default/members/jbosscache/freezone/docs/1.4.1.SP4/tutorial/en/html_single/index.html which looks a pretty old doc?

Well, depends the environment in which you're in. If you're within an application server, you get a UserTransaction from JNDI or from an EJB context. 

If you're outside of an application server, you should be using something like JBoss Transactions that allows setting up a transaction manager and getting a user transaction. You can find examples in their docu.

Finally, DummyTransactionManager does what it says on the tin. It's dummy, so it's not really a transaction manager, it's simply used as a mock for testing purpouses and hence you shouldn't be using it in conjunction with your production code.

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4240929#4240929

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4240929

More information about the jboss-user mailing list