Thanks for your support.
Regarding your suggestion about functors: I'm actually thinking that something
akin to a materialized view would be almost better. I may have the SQL
terminology wrong, but the idea is that you take a query and then map the
results to a table. When the underlying data is changed, then the results are
updated.
The idea is that once you get your initial results, you would attach node
listeners to the tree (perhaps just a region) and the results would be updated.
In a case of a sorted query, the sorted data would be updated then.
I think this would probably be the best of both having an ordered result and
what you speak of. You'd effectively have O(1) performance. The only negative
consequence is that performance would be less.
I guess the implementation would be something like this:
| public CacheQuery {
| void evaluate(Node n);
| Node getResultRoot();
| void close();
| }
|
The queries would run against a region, not the whole tree. The key would be
the "close" method that detaches the listener from the region when done. The
problem is, how do you deal with all the locking and things like node removals?
If you are curious, though, I actually got a POJO TreeMap implemented using the
OrderedNode. I can send the patches to you to look at. Though I do agree that
it would almost be better to have a query language. I tried getting a TreeSet
done, but it's actually very difficult as it's almost impossible to write a
comparator for a Map's value. (You can try as an exercise.) What I would end up
doing is keeping two trees around.
As for per-node expiration (removal), I believe that my implementation is
"hacky" but doesn't impact the rest of the core code. If there is sufficient
interest, it might be best to integrate it as a more developed feature.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3990830#3990830
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3990830
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user