[jboss-dev-forums] [Design of JBossCache] - Re: JBossCache Cache Mgmt interceptor hit/miss not collected
mabc101
do-not-reply at jboss.com
Thu Aug 23 08:23:42 EDT 2007
Thanks Manik for your prompt response.
I am including the section of the code from CacheMgmtInterceptor below.
As you can see the case statement for "get" which keeps hit/miss stats count, is for "getKeyValueMethodLocal" case only. If I call the method without the key (as indicated in my previous post), the default case is invoked, so the hit/miss count is not captured.
I believe this is by design and I just want to understand the semantic difference between the two cases, ie, using "get" without key has a different purpose (perhaps internally - like node visits for eviction etc - which logically should not increment the hit/miss count - but I am treading on this ice here) vs "get" with key which actually returns data and therefore should update the stats.
Here is the code segment:
==============================================
switch (m.getMethodId())
{
case MethodDeclarations.getKeyValueMethodLocal_id:
//fqn = (Fqn) args[0];
//key = args[1];
t1 = System.currentTimeMillis();
retval=super.invoke(m);
t2 = System.currentTimeMillis();
if (retval == null)
{
m_miss_times = m_miss_times + (t2 - t1);
m_misses++;
}
else
{
m_hit_times = m_hit_times + (t2 - t1);
m_hits++;
}
break;
case MethodDeclarations.putKeyValMethodLocal_id:
case MethodDeclarations.putFailFastKeyValueMethodLocal_id:
//fqn = (Fqn) args[1];
//key = args[2];
//value = args[3];
t1 = System.currentTimeMillis();
retval=super.invoke(m);
t2 = System.currentTimeMillis();
m_store_times = m_store_times + (t2 - t1);
m_stores++;
break;
case MethodDeclarations.putDataMethodLocal_id:
case MethodDeclarations.putDataEraseMethodLocal_id:
//fqn = (Fqn) args[1];
attributes = (Map)args[2];
t1 = System.currentTimeMillis();
retval=super.invoke(m);
t2 = System.currentTimeMillis();
if (attributes != null && attributes.size() > 0)
{
m_store_times = m_store_times + (t2 - t1);
m_stores = m_stores + attributes.size();
}
break;
case MethodDeclarations.evictNodeMethodLocal_id:
case MethodDeclarations.evictVersionedNodeMethodLocal_id:
//fqn = (Fqn) args[0];
retval=super.invoke(m);
m_evictions++;
break;
default :
retval=super.invoke(m);
break;
}
return retval;
}
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4077280#4077280
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4077280
More information about the jboss-dev-forums
mailing list