You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Berin Loritsch <bl...@apache.org> on 2002/10/04 05:07:43 UTC
Delegate Implementation is in place
Leo, I think I am quite happy with the Delegate classes and their JavaDocs.
I would like to get some more opinions from the rest of us to see if
this is something that you would find useful in your stuff.
Peter, it seems that this might really help out with the Interceptor stuff.
For instance, you can have a set of static methods that hold all the logic
for your interceptors, and then invoke them with the Delegate to the correct
method. It is faster than giant switch/if/then/else networks, and takes
up less space than several small classes in the JAR.
We will most likely be pushing for a place in Commons for this--to get the
widest audience. Maybe someone will be able to generate proxies that
live in the same class/package as the delegated method. That would expose
the delegate to anything the current scope can see.
It will definitely help out with getting all the components implementing
a stage to be put through their paces like this:
initDelegate.initialize();
and all the components are initialized! It makes for cleaner code and
hides the looping code.
--
"They that give up essential liberty to obtain a little temporary safety
deserve neither liberty nor safety."
- Benjamin Franklin
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Delegate Implementation is in place
Posted by Peter Donald <pe...@apache.org>.
On Sat, 5 Oct 2002 19:23, Leo Simons wrote:
> On Fri, 2002-10-04 at 09:25, Peter Donald wrote:
> > On Fri, 4 Oct 2002 13:07, Berin Loritsch wrote:
> > > Peter, it seems that this might really help out with the Interceptor
> > > stuff. For instance, you can have a set of static methods that hold all
> > > the logic for your interceptors, and then invoke them with the Delegate
> > > to the correct method. It is faster than giant switch/if/then/else
> > > networks, and takes up less space than several small classes in the
> > > JAR.
> >
> > Kool - I will check it out. However I still can't get interceptor
> > performance to an acceptable level so it looks like BCEL is going to have
> > to be the answer.
>
> hmm. Does that imply you consider all existing architectures that use
> interceptors to provide 'unacceptable' bad performance (I think the vast
> majority of code doesn't resort to BCEL ;)?
The majority of architectures that support invocation interceptors have
unacceptable bad performance when creating fine grain components. The
architectures that do support fine grain components weave it in with a
precompile step (ala ApsectJ) or use BCEL-like mechanisms to compile at
runtime.
Remember that distributed object models (RMI, remote EJB, CORBA etc) are
rarely going to care about a slight call overhead. In the cases where they do
(ie EJB Local interfaces) the interceptor execution is likely to still be the
highest cost (ie starting a transaction which contacts a remote Database or
Transaction Manager). So in this case the cost is minimal.
> What kind of performance are
> you shooting at?
fast. No fixed numbers but I want to use it for fine grain components.
> Would BCEL make it more complex to write an interceptor? Would it make
> it more complex to write a container using the interceptor toolkit?
Makes no difference.
The only thing that it requires is that BCEL be on Classpath. However it could
quite easily be worked so that reflection was used to create the
InterceptorFactory and a BCEL one was attempted to be created first. If that
failed (ie BCEL not on classpath) we could then use the reflection based
factory.
--
Cheers,
Peter Donald
"Man's mind stretched to a new idea never goes back to its original
dimensions." -Oliver Wendell Holmes
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Delegate Implementation is in place
Posted by Leo Simons <le...@apache.org>.
On Fri, 2002-10-04 at 09:25, Peter Donald wrote:
> On Fri, 4 Oct 2002 13:07, Berin Loritsch wrote:
> > Peter, it seems that this might really help out with the Interceptor stuff.
> > For instance, you can have a set of static methods that hold all the logic
> > for your interceptors, and then invoke them with the Delegate to the
> > correct method. It is faster than giant switch/if/then/else networks, and
> > takes up less space than several small classes in the JAR.
>
> Kool - I will check it out. However I still can't get interceptor performance
> to an acceptable level so it looks like BCEL is going to have to be the
> answer.
hmm. Does that imply you consider all existing architectures that use
interceptors to provide 'unacceptable' bad performance (I think the vast
majority of code doesn't resort to BCEL ;)? What kind of performance are
you shooting at?
Would BCEL make it more complex to write an interceptor? Would it make
it more complex to write a container using the interceptor toolkit?
just interested....
- Leo
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Delegate Implementation is in place
Posted by Peter Donald <pe...@apache.org>.
On Fri, 4 Oct 2002 13:07, Berin Loritsch wrote:
> Leo, I think I am quite happy with the Delegate classes and their JavaDocs.
>
> I would like to get some more opinions from the rest of us to see if
> this is something that you would find useful in your stuff.
>
> Peter, it seems that this might really help out with the Interceptor stuff.
> For instance, you can have a set of static methods that hold all the logic
> for your interceptors, and then invoke them with the Delegate to the
> correct method. It is faster than giant switch/if/then/else networks, and
> takes up less space than several small classes in the JAR.
Kool - I will check it out. However I still can't get interceptor performance
to an acceptable level so it looks like BCEL is going to have to be the
answer.
--
Cheers,
Peter Donald
*------------------------------------------------------*
| "Nearly all men can stand adversity, but if you want |
| to test a man's character, give him power." |
| -Abraham Lincoln |
*------------------------------------------------------*
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: Delegate Implementation is in place
Posted by Leo Sutic <le...@inspireinfrastructure.com>.
Vinay,
the DelegateHandler handles the equals() because it is
neccessary to test at times whether two *delegates* are
equal. This is needed in the MultiDelegate, and if you ever
want to use the delegate in a Collection, you have to.
That's the only way of doing it.
/LS
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: Delegate Implementation is in place
Posted by Vinay Chandran <vi...@yahoo.com>.
Hi,
A few queries+patches regarding the delegates.
Why does the DelegateHandler handle the "boolean
equals(Object)" .
I guess the intend was to handle the
Object.equals(Object) call ,
but I guess the InvocationHandler would only cater to
the method
defined within the interface and thus I could have a
delegate
interface like:-
interface DelegateInf
{
boolean equals(Object o);
}
and because of the handling of the equals within the
Delegate
InvocationHandler , the implementation attached while
creating
the delegate does not get Invoked.
(a patch to the DelegateTestcase to illustrate this
is attached)
Patch on Delegate.java for breaking out of conditions:
--------------------------------------------------
298a299
> break;
304a306
> break;
PATCH on DelegateTestCase.java
---------------------------
120a120,139
>
> public interface Test
> {
> boolean equals(Object o);
> }
> public class TestImpl
> {
> public boolean equals(Object o)
> {
> System.out.println("***invoked****");
> return true;
> }
> }
> public void testEquals()
> {
> Test test = (Test)Delegate.newDelegate(new
TestImpl(),"equals",Test.class);
>
> // The equals override within TestImpl always
returns true .
> // yet this test Fails since InvocationHandler
handled
> // this invocation
>
> assertTrue(test.equals("1")); //*** FAILURE
> }
Regards,
Vinay
__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: Delegate Implementation is in place
Posted by Leo Sutic <le...@inspireinfrastructure.com>.
> From: Berin Loritsch [mailto:bloritsch@apache.org]
>
> Leo, I think I am quite happy with the Delegate classes and
> their JavaDocs.
Thanks for doing the documentation work - it looks vastly better.
I guess it is obvious which one of us is capable of writing a
book.
/LS
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>