On Wednesday 7 September 2005 12:17, Roman Kennke wrote: > That was introduced by me. Honestly I don't remember myself why I found > this important. I think I might have been mislead of the API docs in > ComponentUI.createUI(): 'If the UI delegate is stateful, then it should > return a new instance per component.' > > I think it would be ok to change this to simply return a new instance > on each call without storing them in the hashtables.
Based on my long time usage of those classes in the 'other' jvm; Keeping the UI delegate instance makes sense if you can reuse it for all classes. If at all possible; the delegates should be written without statics (save for one 'instance' static) and don't use members at all. If you can adhere to this then one delegate in the entrire JVM is cheapest. This approuch is possible only if the SUN API did not define protected members that disable that approuch, naturally. (Sun really did a bad job designing those for reuse :( ) Note that the HashMap idea is really broken due to the fact that you retain both the component and the delegagte-instance, which means that all widgets instanciated will never be garbage collected. -- Thomas Zander
pgptI6HCRfcVf.pgp
Description: PGP signature
_______________________________________________ Classpath mailing list [email protected] http://lists.gnu.org/mailman/listinfo/classpath

