On 19 Jan 2009, at 15:14, Niclas Hedhman wrote:
On Mon, Jan 19, 2009 at 2:49 PM, Calum Shaw-Mackay
<[email protected]> wrote:
Okay to make things clearer
Thanks.
System 'A' is a container of sorts, Object 'B' is a component that
Object C
(the caller) wishes to utilise and conenct with at runtime
Well, a lot depends on what the "Container of Sorts" really do.
It definitely looks like the classes will end up in separate
classloader, hence be perceived different. AFAICT, you are out of
luck, unless you can dig up some cool feature in the container. What
container are we talking about?
But hold on a second, if the container passes an instance from B to C,
then there should not be much classloading involved. You should more
likely get a ClassCastException. Weird.
It could well be that one.... I haven;t fired up my code in a couple
of weeks because of this impasse
One way you should get this to work would be a reflective bridge,
which is a lot more effective than networked communications. In
essence;
I did have a message based interpretation that devolved the method
invocation into a simple
method signature, with an associated list of parameters... but I have
other issues with that
Create in C a dynamic proxy implementing Interface, whose invocation
handler has a reference to the object retrieved from B, and the
InvHandler do
public Object invoke( Object proxy, Method m, Object[] args )
{
Method m2 = b.getMethod( m.getName(), m.getArgumentTypes() );
return m.invoke( b, m2, args );
}
That's essentially what it does, but I think the ClassCastException is
getting in the way.
I may well need to build some interpolation that devolves the method
(removes the classloader reference of a normal method call) and then
invokes the call against the callee
Just wondered whether there was some PreferredClassLoader buffoonery
that I could do so I could avoid this devolution
but you will still have problems if any arguments are other shared
types.
Cheers
--
http://www.qi4j.org - New Energy for Java
--
http://www.qi4j.org - New Energy for Java
--------------------------------------------------------------------------
Getting Started: http://www.jini.org/wiki/Category:Getting_Started
Community Web Site: http://jini.org
jini-users Archive: http://archives.java.sun.com/archives/jini-users.html
Unsubscribing: email "signoff JINI-USERS" to [email protected]