Michael McKibben wrote: > This is an interesting idea! It would be a useful CM for stateless, non > thread-safe components. You could then have a pool of them that get > automatically placed back in the pool after each method invocation.
Yes, if there's only few method calls on the same component per request (which is not uncommon). The idea could also be extended to provide something like: <interceptor class="com.mycompany.AccessController"> <match role="com.mycompany.UserManager"> <operation name="getUserInfo"/> <operation name="set*"/> </match> <configuration> <role name="Administrator"/> </configuration> </interceptor> > One gotcha with proxies is with the methods from java.lang.Object. You > must handle these specially. For example, consider the following code: > > myproxy.equals(myotherproxy) > > Under the covers, your invocation handler calls: > > component.equals(myotherproxy) In some cases, an explicit type cast is required, and sometimes it can be useful to check for things like: method.getDeclaringClass().isAssignableFrom(obj.getClass()) Proxy.isProxyClass(obj.getClass()) > Of course this will at best return false, and at worst throw a > ClassCastException if your component overrides the default equals() and > expects the argument to be of the component type. I've seen this happen, but people who implement equals() should know better :) (: A ;) -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>