From: Bill H. <bi...@lo...> - 2003-09-06 15:43:53
|
On Fri, 2003-09-05 at 14:45, Bill Horsman wrote: > Hi, > > We're looking at replacing our use of JDK 1.3's proxy classes with those > from http://asm.objectweb.org. The big benefit we get, other than > possible performance improvements, is independence from using JDK 1.3. > Our goal is to continue to support JDK 1.2 for a good while yet. > > The trouble is that we also make some other references to JDK 1.3+. Namely: > > 1) ShutdownHooks. These ensure that Proxool is properly shutdown when > the JVM dies. It works really well and is much more robust than using > finalize(). > > 2) We use a Timer class to collect statistical information. We can get > round this with either a thread that sleeps for a while and keeps > checking the time. Or possibly look around for a third party solution. I've been thinking about this. We could use the new proxy to handle both the Timer and the ShutdownHook too. For instance, for the Timer we write and interface that Timer is able to implement and then write our own JDK1.2 implementation. At runtime, we try and load the JDK1.3 Timer and if that fails, use our own implementation instead. The proxy classes are used to get JDK1.3's Timer to implement our interface at runtime. I think that would work. Advantages: 1) We get to use the (probably) more efficient JDK1.3 classes if available. 2) Our code compiles with all JDKs. Disadvantages: 1) It might be a bit slower (but this doesn't matter because both ShutdownHook and Timer are only constructed at startup). Christian, if you are working on the proxy stuff over the next few days then you might want to think about this). Cheers, Bill |