Hi,
I have a large number of objects in my cache (1000) all under the same node (/a/b),
all instances of the same class (A). Each of these objects itself contains a Vector of
objects (class B). Part of my business logic requires calling a method of class B for
all class B instances contained in all Class A instances.
I've implemented this as follows:
1. query for all class A instances
myTree.getChildrenNames("/a/b")
2. for each FQN in the returned Set, get the object
A obj = (A) myTree.getObject(FQN)
3. for each instance of class A, iterate over the Vector of B's calling the method
When running this test, it takes around 4 - 5 seconds to complete. I really need this
time to be around 0.5 seconds. When using a Vector in place of the cache, the test
takes less than 100 ms - hardly surprising since the objects are already in memory.
I assume that the creation of the objects (during the myTree.getObject() process) is
what is taking the time.
The best solution I can think of is to maintain two copies of the objects that I need
to quickly iterate over. One copy in the cache, a separate copy in memory (a Vector).
This solution is viable only because this fast iteration only involves reading the
object's data. When the object changes (in the cache) I can update the Vector version
through a TreeCacheListener.nodeModified() mechanism.
Has anyone else faced a similar issue?
Have I overlooked a way to just use the cache only to do this fast iteration?
Many thanks
Ken
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3848905#3848905
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3848905
-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development