geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Berin Loritsch <blorit...@apache.org>
Subject Re: [bcel] Is anyone a BCEL expert?
Date Mon, 25 Aug 2003 12:43:51 GMT
Dain Sundstrom wrote:

> We are going to need some BCEL code which varies from simple to quite 
> complex.  If you are an expert or eager to learn, here is what we need 
> (from simple to complex):
> 
> 
> 
> Interface proxy generator -- This is a copy of java.reflection.Proxy.  
> Why do we need a copy?  Well I think it is a good starting point for the 
> rest of the stuff, and I know we can do it better.  I would like the 
> proxy generator to be able to generate class names that have some 
> meaning other then Proxy$24, and I think we can write code that this 
> faster.

I'm not an expert, but the Avalon Fortress Codebase has something to
start with for proxying components based on interfaces.  Essentially
it works by only exposing the interfaces you want exposed (like the
client interfaces), and forwards the call on to the original object.
Due to the fact that it is BCEL generated and it essentially creates
the equivalent of this:

public void foo()
{
    proxied.foo();
}

It is much faster than the java.lang.Proxy which is based completely
on reflection (you are always invoking a method via the
java.lang.reflect.Method object).  However, there is a performance hit,
which should be acceptable in all but the most grueling environments.

There are some minor issues with it though.  For instance when you
invoke a method through BCEL, it has to be called on the class that
implements the method.  For instance if you have AbstractFoo and
FooImpl, with the method foo() (from above) implemented in AbstractFoo,
then BCEL has to call AbstractFoo.foo()--it is not smart enough to
follow the inheritance heirarchy to find the class for you.

Anyhoo, it is a starting place.



> 
> 
> This should be a very fun project.  I'd do it myself, but I've got too 
> many other things on my plate right now.
> 

Working with BCEL is an excercise in masochism--but it is very powerful
once you have it working for you.

-- 

"They that give up essential liberty to obtain a little temporary safety
  deserve neither liberty nor safety."
                 - Benjamin Franklin


Mime
View raw message