geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Monson-Haefel <Rich...@Monson-Haefel.com>
Subject Re: [bcel] Is anyone a BCEL expert?
Date Mon, 25 Aug 2003 09:29:57 GMT
On 8/22/03 8:11 AM, in article
EA8D3CAC-D4B2-11D7-8482-000393DB559A@coredevelopers.net, "Dain Sundstrom"
<dain@coredevelopers.net> wrote:
> 
> So the line newInstance line becomes:
> 
> InstanceFactory factory = getInstanceFactory(clazz);
> return factory.newInstance();
> 
> Notice this is not using a reflection call, it would raw byte code to
> create a new instance the normal java way and has the exact same cost
> as calling an interface method (duh, it is a call on an interface
> method).  This is another flexibility versus speed trade off.  To keep
> the factory simple, it can only create classes with no arguments.  I
> used beclifier to do this, but I really don't understand BECL, so I
> would not want to commit it.

This might be a little out of left field, but ...


One way to get flexibility and speed is to use the more dynamic
newInstance() approach the first time for a class and then cache the byte
code so that the factory can create instance quicker on subsequent requests.
 



Mime
View raw message