[jboss-user] [JBoss Cache: Core Edition] - What keeps putForExternalRead from suffering the thundering-

jshowalter do-not-reply at jboss.com
Wed Mar 4 16:01:37 EST 2009


We have code that looks like this:

Data getSomeData(key)
{
Data theData = theCache.get(node, key);

if (theData == null)
{
theData = read the data from database
theCache.putForExternalRead(node, key, the data from database);

return theData;
}

Now suppose we have a bunch of threads that hit getSomeData at the same time with the same key.

Will several threads get a null data, read from the database, and do the putForExternalRead, with only the first call to putForExternalRead having any effect?

It would be desirable not to have to pay the overhead of multiple database reads in this situation.


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

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



More information about the jboss-user mailing list