Hey Ole, > For the TxCapsule change from collections to arrays: I have to > admit that this is ugly compared to the performance gained. sorry I didn't get, you mean that there was no performance gain ? Isn't ArrayList as fast as arrays, and it avoids you the System.arraycopy for shrink-enlarge, etc ? > But it is all hidden in private fields and methods. > For the timeout code: The Java collection classes do not have > a data structure implementing a priority queue, so I had to > write it myself. And by not factoring the priority queue out into > a seperate classs, I am able to do timeout cancels in time > O(log(n)). Since then I have learned that JavaSoft used the same > algorithm in the java.util.Timer code, except they _did_ factor > the priority queue out into another class so that individual > timers cannot be cancelled in an efficient way. > But all of this is hidden in private fields and methods in the > org.jboss.util.timeout.TimeoutFactory class. > IMHO this hairy algoritm is needed for jBoss to scale well. Well, got the same problem for the tasks that resize the cache and passivate the old beans, and ended up writing a class very similar to java.util.Timer, and a priority queue class that is reusable (org.jboss.util.Heap). I'll commit it very soon, you may take a look at it and see if it's worth reusing in the timeout package. > For the implementation I care a lot less about ugly code. The > code should IMHO be as simple and easily readable as possible Isn't this caring about the way the code is written :-) ? > while still doing the needed job with the needed efficiency. > But if ugly code in the implementation is needed to get the job > done with the needed efficiency, I'll accept ugly code. Well, bear in mind that the compiler will generate the same bytecode if you write if (array[++getIndex()].function() > 0) or int index = getIndex(); ++index; MyObject obj = array[index]; int result = obj.function(); if (result > 0) which is IMHO less ugly than the former. All this will not affect performance, but affects very much mantainability of the code. > Comments anyone? Go on with the good job you made until now ! Best Regards, Simon
