Hi,

The above mentioned proxiing seems to work fine for ThreadSafe or SingleThreaded 
components (that do not use Selector) in my place.
As I wanted to get rid of deprecations (not moving to Fortress or Merlin yet) I tried 
to remove the Component interface.
Two problems arose from this:

1. When using a Selector the role is AbcSelector for implementation Abc but no class 
AbcSelector exists (of course) -> ClassNotFoundException ...
I think this can be fixed by the following patch (DefaultComponentFactory; line 300):


+        final String role;
+        if ( m_role.endsWith( "Selector" ) )
+        {
+            role = m_role.substring( 0, m_role.indexOf( "Selector" ) );
+        }
+        else
+        {
+            role = m_role;
+        }

(or just: final String role = m_role.substring( 0, m_role.indexOf( "Selector" ) );)

+        returnableComponent = m_proxyGenerator.getProxy( role, component );
-         returnableComponent = m_proxyGenerator.getProxy( m_role, component );


2. When a component is poolable the pool needs to cast it after getting it from the 
component factory but the proxy cannot be cast. 
As it is just a markup interface the proxy might be extended in this case by one more 
interface (ComponentProxyGenerator; line 105):


+        final Class[] proxiedInterfaces;
+        if ( service instanceof Poolable )
+        {
+            proxiedInterfaces = new Class[]{Component.class, Poolable.class, 
+serviceInterface};
+        }
+        else
+        {
+            proxiedInterfaces = new Class[]{Component.class, serviceInterface};
+        }

+        return (Component)Proxy.newProxyInstance( m_classLoader,
+                proxiedInterfaces,
+                new ComponentInvocationHandler( service ) );


-         return (Component)Proxy.newProxyInstance( m_classLoader,
-                 new Class[]{Component.class, serviceInterface},
-                 new ComponentInvocationHandler( service ) );


Have a nice day,

Michael

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to