[jboss-jira] [JBoss JIRA] Updated: (JBCACHE-760) TreeCacheListener in PojoCache gets nodeModify events for invalid objects

Nitzan Niv (JIRA) jira-events at jboss.com
Thu Sep 7 12:15:43 EDT 2006


     [ http://jira.jboss.com/jira/browse/JBCACHE-760?page=all ]

Nitzan Niv updated JBCACHE-760:
-------------------------------

    Attachment: TreeCacheAopListenerTest.java

tests for events on a PojoCache

> TreeCacheListener  in PojoCache gets nodeModify events for invalid objects
> --------------------------------------------------------------------------
>
>                 Key: JBCACHE-760
>                 URL: http://jira.jboss.com/jira/browse/JBCACHE-760
>             Project: JBoss Cache
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: PojoCache
>    Affects Versions: 1.4.0.SP1
>            Reporter: Nitzan Niv
>         Assigned To: Manik Surtani
>         Attachments: TreeCacheAopListenerTest.java
>
>
> In PojoCache with a registered event listener, when inserting a collection (Map, List) to the cache, the listener gets events for the creation and then the modification of the collection object. On a nodeModify() event (with pre==false), if you call the cache's getObject with the received fqn you get the following runtime exception (which did not occur on 1.3.0SP2 in a similar scenario). 
> I believe the modification event is raised before the collection is "really" inserted into the cache, so the fqn points to an invalid object.
> java.lang.RuntimeException: TreeCacheAopDelegate._getObject(): null AOPInstance.
> 	at org.jboss.cache.aop.TreeCacheAopDelegate._getObjectInternal(TreeCacheAopDelegate.java:122)
> 	at org.jboss.cache.aop.TreeCacheAopDelegate._getObject(TreeCacheAopDelegate.java:92)
> 	at org.jboss.cache.aop.PojoCache._getObject(PojoCache.java:722)
> 	at org.jboss.cache.aop.PojoCache.getObject(PojoCache.java:416)
> 	at org.jboss.cache.notifications.TreeCacheAopListenerTest$EventLog.nodeModify(TreeCacheAopListenerTest.java:268)
> 	at org.jboss.cache.TreeCache.notifyNodeModify(TreeCache.java:5832)
> 	at org.jboss.cache.TreeCache._put(TreeCache.java:4425)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:324)
> 	at org.jgroups.blocks.MethodCall.invoke(MethodCall.java:321)
> 	at org.jboss.cache.interceptors.CallInterceptor.invoke(CallInterceptor.java:52)
> 	at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
> 	at org.jboss.cache.interceptors.PessimisticLockInterceptor.invoke(PessimisticLockInterceptor.java:80)
> 	at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
> 	at org.jboss.cache.interceptors.UnlockInterceptor.invoke(UnlockInterceptor.java:32)
> 	at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
> 	at org.jboss.cache.interceptors.TxInterceptor.handleNonTxMethod(TxInterceptor.java:345)
> 	at org.jboss.cache.interceptors.TxInterceptor.invoke(TxInterceptor.java:156)
> 	at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
> 	at org.jboss.cache.interceptors.CacheMgmtInterceptor.invoke(CacheMgmtInterceptor.java:157)
> 	at org.jboss.cache.TreeCache.invokeMethod(TreeCache.java:5520)
> 	at org.jboss.cache.TreeCache.put(TreeCache.java:3678)
> 	at org.jboss.cache.TreeCache.put(TreeCache.java:3349)
> 	at org.jboss.cache.aop.InternalDelegate.put(InternalDelegate.java:133)
> 	at org.jboss.cache.aop.InternalDelegate.putAopClazz(InternalDelegate.java:273)
> 	at org.jboss.cache.aop.CollectionClassHandler.collectionObjectPut(CollectionClassHandler.java:115)
> 	at org.jboss.cache.aop.TreeCacheAopDelegate._putObject(TreeCacheAopDelegate.java:213)
> 	at org.jboss.cache.aop.PojoCache._putObject(PojoCache.java:731)
> 	at org.jboss.cache.aop.PojoCache.putObject(PojoCache.java:462)
> 	at org.jboss.cache.aop.PojoCache.putObject(PojoCache.java:423)
> To recreate the problem I use a test case similar to TreeCacheListenerTest but with a PojoCache. The test is:
>    public void testNodeCreatedAndModifiedMapEvent() throws Exception {
>        EventLog el = new EventLog(cache);
>        cache.addTreeCacheListener(el);
>        Map data = new HashMap();
>        data.put("key", "value");
>        cache.putObject("/hello/world", data);
>        ...
>   }
>  and the relevant listener code:
>       public void nodeModify(Fqn fqn, boolean pre, boolean isLocal)  {
>          events.add("modify "+
>                  (pre? "about to modify " : "Modified ") +
>                  (isLocal? "local " : "remote ") + fqn);
> 		 if(this.cache != null && !pre) {
> 			try {
> 				cache.getObject(fqn);
> 			}
> 			catch (Exception e) {
> 				events.add(e);
>                 e.printStackTrace(System.err);
> 			}
> 		 }
>       }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list