geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Mulder <ammul...@alumni.princeton.edu>
Subject Re: Dynamic proxies
Date Thu, 07 Aug 2003 15:51:52 GMT
	For what it's worth, JBoss implemented an extension to let you use
dynamic proxies against abstract classes as well as interfaces.  But once
you've gone that far, it seems to me that it's not that much further to
just generate the code you want to execute, rather than generating a proxy
to call some grand unified reflection-based method with a bunch of
if/elses that decide what to do.  In either case, you're going to be 
spending a lot of time with BCEL or the equivalent.  :)

Aaron

On Thu, 7 Aug 2003, Alex Blewitt wrote:
> Dynamic Proxies in Java allowed developers to say:
> 
> "Give me a new class that implements interface X so that all method  
> calls are actually routed through to this piece of code"
> 
> Essentially, a Dynamic Proxy allows you to have:
> 
> public interface Thing {
>    public void doMethod();
>    public void doAntoherMethod();
> }
> 
> and your code
> 
> public class Processor implements InvocationHandler {
>    public void invoke(Object target, Method method, Object args) {
>      // do anything
>    }
> }
> 
> and then say
> 
> Thing t = Proxy.getProxyClass(Thing.class, new Processor());
> 
> so that t.doMethod() and t.doAnotherMethod() both end up with your  
> Processor method.
> 
> See  
> http://java.sun.com/j2se/1.4.1/docs/api/java/lang/reflect/Proxy.html  
> for more info.
> 
> Unfortunately, the ProxyClass is a bit knackered in that it only works  
> with interfaces, not with all abstract types (i.e. abstract classes as  
> well). Had it been designed to deal with all abstract types (like the  
> inner classes do) then it'd have been much nicer.
> 
> PS There are syntax errors above; this is from memory.
> 
> On Thursday, Aug 7, 2003, at 15:09 Europe/London, Justin Ju wrote:
> 
> > What do you mean about dynamic proxies?
> > Is it one of  the design patterns?
> > ----- Original Message -----
> > From: "Lyytinen Joonas" <joonas.lyytinen@cons.sonera.com>
> > To: <>
> > Sent: Thursday, August 07, 2003 7:43 PM
> > Subject: RE: how about maven?
> >
> >
> > Hi everyone,
> >
> > I'm new to the list and don't know how much general discussion around
> > this has allready been had, but before starting the implementation of
> > the EJB container a good deal of though probably should be given to the
> > implementation architecture of the EJB container.
> >
> > AFAIK currently there are three approaches to the EJB problem domain
> >
> > 1. Managing the EJB's using reflection
> > 2. Managing the EJB's through dynamic proxies
> > 3. Managing the EJB's using JMX
> >
> > Of these, the last one is newest and thus has the least references.  
> > There is a good
> > academic study on the first two approaches  
> > (http://www.cs.rice.edu/CS/Systems/DynaServer/> perf_scalability_ejb.pdf)
> > which states that there is no major performance  differences between  
> > the two.
> >
> >
> > Has anyone any experiences with the JMX approach and data of it's  
> > performance?
> > Maybe it would be beneficial to build small POC's of each before  
> > starting the proper
> > implementation?
> >
> >
> >
> >> how about MX4J code, I see the code is
> >> under  License: Apache Software License
> >> that a good thing :-)
> 


Mime
View raw message