geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Blewitt <Alex.Blew...@ioshq.com>
Subject Re: Dynamic proxies
Date Thu, 07 Aug 2003 14:17:26 GMT
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