On Jul 15, 2006, at 7:26 AM, Jeremy Boynes wrote:

There are a couple of places where we need to create an XMLStreamReader and to do this we are doing XMLInputFactory.newInstance("javax.xml.stream.XMLInputFactory", classLoader) to obtain the factory (the classloader is the runtime classloader and this form avoids messing with the TCCL).

I think it would be better to add a system service that components can wire to rather than using the newInstance() call everywhere. The problem is that XMLInputFactory is an abstract class so cannot be used as a service interface.

We can tackle this two ways:
1) add support for class-based services as we need that for the spec anyway 2) add an interface our components use instead of XMLInputFactory (e.g. o.a.t.spi.services.XMLInputFactory)

The first is going to require some asm magic to bytecode generate concrete subclasses and a bunch of other work to integrate it. Although we need to do this at some point, it seems like a lot of effort to solve this particular problem.

I'd like to suggest we go with the second option as an interim solution.
Any comments? Is this a service anyone is interested in implementing?

The second option sounds good for the short-term, however, I think we should tackle the first sooner rather than later. I'd like to revisit the proxy generation strategy in the runtime as well in this context. Specifically, as a result of using JDK proxies, we have to do a Map- based lookup on Method for each invocation (see JDKOutboundInvocationHandler). Method.equals() is horribly inefficient. I'd like to come up with an alternative which avoids reflection as much as possible, perhaps using ASM to implement an index-based approach. Of course, we'll still need to keep the JDK proxy option for the paranoid types that have unreasonable security policies ;-)

Currently, we have a WireService which generates proxies. We could have alternative implementations which use ASM or some other mechanism to do this. Thoughts?

Jim

--
Jeremy


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to