-
1. Re: help with how to debug
jiwils May 14, 2005 2:03 AM (in response to plainkeyman)It is unlikely that something other than your code is making changes to your objects.
You could implement a TreeCacheListener or use one of the pre-existing TreeCacheListener implementations such as TreeCacheView, TreeCacheView2, or ConsoleListener to give you a peek into cache events. Check out the Javadoc packaged as a part of the JBossCache distribution to have a look at the interface and various implementations mentioned. -
2. Re: help with how to debug
plainkeyman May 14, 2005 2:59 PM (in response to plainkeyman)thankyou for your suggestion. i tried adding this to my TreeCache (not aop):
class debugListener implements TreeCacheListener { public void nodeCreated(Fqn fqn) { System.out.println( "** node added: " + fqn);} public void nodeRemoved(Fqn fqn) { System.out.println( "** node removed: " + fqn);} public void nodeModified(Fqn fqn) { System.out.println( "** node modified: " + fqn);} public void nodeLoaded(Fqn fqn) { System.out.println("** node loaded: " + fqn);} public void nodeEvicted(Fqn fqn) { System.out.println("*** node evicted: " + fqn);} public void nodeVisited(Fqn fqn) {} public void cacheStarted(TreeCache cache) {} public void cacheStopped(TreeCache cache) {} public void viewChange(View new_view) { System.out.println("** view change: " + new_view); } }
unfortunately my object still changed without printing a "node modified" statement. so i know it has to be something i'm doing wrong. but how do i find it?
the actual part of my object that actually changes is a 'private member' (an int[]). the accessor method does not even get called (i tried printing stuff there).
i tried putting a breakpoint on it but there are hundreds of of these objects -- with hundreds of legitimate accesses.
the weird part of the problem is that it only happens after like 30 min with other objects being accessed.
sorry i'm rambling on here... here's my questions:
1) are there any timeout values in the treecache that i may not know about (this a local cache)
2) i do implement clone(), hashCode(), toString() in all of my objects... (i've looked at them and they seem ok). does treecache call these methods after a long period of time?
3) is there a debugger that can show me all instances of an object and let me put a breakpoint on just one of them?
4) is there a tool the will let me see all of the references to an object (maybe some strange piece of code still has a refeference to my object and i don't know about it) -
3. Re: help with how to debug
plainkeyman May 16, 2005 12:57 PM (in response to plainkeyman)ok i think i found it. i was storing several of my entity beans into one object. then i was caching this object in jboss-cache. some how the entity beans were changing (but they still shouldn't have). i got around this by caching a clone of the objects.
should i not be doing this?
thanks,
richard