[jboss-user] [JBoss Cache: Core Edition] - Found Bug with Hibernate, TreeCache and Cacheloader, if pass

HolgiBln do-not-reply at jboss.com
Thu Oct 23 05:35:24 EDT 2008


First: Sorry for my english ;)

Environment:
JBoss 4.3.0 EAP
TreeCache 1.4.1 SP8 and SP10
Hibernate 3.2


If i use an CacheLoader (in my use case the FileCacheLoader) and locking is PESSIMISTIC and passivation is set to false,
the FileCacheloader doesn't store anything. Only if i change to passivation true or is user locking OPTIMISTIC.

The Problem/Bug is clear and found in the CacheStoreInterceptor. If PESSIMISTIC locking is configured,
Hibernate use cache.putfailfast. In this case, the MethodId in CacheStoreInterceptor is 4 (MethodDeclarations.putFailFastKeyValueMethodLocal).
But this isn't handle in the CacheStoreInterceptor, so no CacheLoader is called.

Original Code:

  |       switch (m.getMethodId())
  |       {
  |          case MethodDeclarations.putDataMethodLocal_id:
  |          case MethodDeclarations.putDataEraseMethodLocal_id:
  |             Modification mod = convertMethodCallToModification(m);
  |             log.debug(mod);
  |             fqn = mod.getFqn();
  | 
  |             loader.put(Collections.singletonList(mod));
  |             if (cache.getUseInterceptorMbeans()&& statsEnabled)
  |                m_cacheStores++;
  |             break;
  |          case MethodDeclarations.putKeyValMethodLocal_id:
  |             fqn=(Fqn)args[1];
  |             key=args[2];
  |             value=args[3];
  |             tmp_retval = loader.put(fqn, key, value);
  |             use_tmp_retval = true;
  |             if (cache.getUseInterceptorMbeans()&& statsEnabled)
  |                m_cacheStores++;
  |             break;
  |       }
  | 

Worked Code:

  |       switch (m.getMethodId())
  |       {
  |          case MethodDeclarations.putDataMethodLocal_id:
  |          case MethodDeclarations.putDataEraseMethodLocal_id:
  |             Modification mod = convertMethodCallToModification(m);
  |             log.debug(mod);
  |             fqn = mod.getFqn();
  | 
  |             loader.put(Collections.singletonList(mod));
  |             if (cache.getUseInterceptorMbeans()&& statsEnabled)
  |                m_cacheStores++;
  |             break;
  |          case MethodDeclarations.putKeyValMethodLocal_id:
  |          case MethodDeclarations.putFailFastKeyValueMethodLocal:
  |             fqn=(Fqn)args[1];
  |             key=args[2];
  |             value=args[3];
  |             tmp_retval = loader.put(fqn, key, value);
  |             use_tmp_retval = true;
  |             if (cache.getUseInterceptorMbeans()&& statsEnabled)
  |                m_cacheStores++;
  |             break;
  |       }
  | 

Regards, Holger

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

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



More information about the jboss-user mailing list