[Design of JBoss Remoting, Unified Invokers] - Re: Remoting unmarshalling vs. class loaders
by scott.stark@jboss.org
"david.lloyd(a)jboss.com" wrote :
| You mean so that the client can pick the right classloader to unmarshal the response? I think that clients should also be associated with a CL as well (anyway we need to do that to allow us to specify a RemoteClassLoader on the client side). I doubt there is likely to be a 1:1 correspondence between classloaders on the client and server side, so I don't really see the benefit of annotating the response with classloader information.
|
No, I mean if the response object container the unmarshalled object that is going to be streamed by the transport layer after the handler has cleared the TCL, possibly in another thread.
"david.lloyd(a)jboss.com" wrote :
| Setting the TCL for the duration of any task that handles a request is doable though. There are currently no plans to implement any form of lazy unmarshalling. We will need to ensure that the streaming facility can have access to the marshaller as well as the classloader.
The TCL only works for class loading that occurs in the scope of a request dispatch. The concern is for marshalling that occurs after the handler has returned, and cleared the TCL.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4169311#4169311
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4169311
17 years, 8 months
[Design of JBossCache] - Re: Common marshalling infrastructure
by david.lloyd@jboss.com
"manik.surtani(a)jboss.com" wrote : Scott is right, this does apply to JBC as well. Currently what I do is I have a concept of cache regions, and users register class loaders per region. Any calls that are then sent over the wire contain the following:
|
| [version id: short][region id: serialized Fqn][payload]
|
| my unmarshalling code currently:
|
| 1. reads the version id and delegates to the appropriate unmarshaller
| 2. unmarshaller reads the region id and sets the TCL appropriate to that region
| 3. continues unmarshalling payload, etc
|
I would continue to do it exactly this way personally. The stream header mechanism should not be used to solve this problem (as designed today) - its purpose is just for verifying e.g. the stream's magic number (if there is one) and version number (if any).
Assuming your region ID is a string, you can just use DataInput.readUTF to read it in (and DataOutput.writeUTF to write it out); should be fairly straightforward.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4169301#4169301
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4169301
17 years, 8 months
[Design of JBoss Remoting, Unified Invokers] - Re: Remoting unmarshalling vs. class loaders
by david.lloyd@jboss.com
"scott.stark(a)jboss.org" wrote : "david.lloyd(a)jboss.com" wrote : So as long as you keep your requests confined to a single classloader (on the receiving side) then things should work out. I think that associating a service with its appropriate classloader would be the right thing to do there (the protocol handler would then choose the classloader based on the service being invoked). Given the R3 design, which makes requests and client instances much more lightweight, mixing classloaders in requests would be an indication of improper service design - if you're doing that, you probably need multiple services (one for each aspect that lives in its own classloader).
| |
| Agreed, the target of the remoting invocation should have a distinct class loader that would be set as the request TCL. However, if there is a lazy or streaming facility that allows the marshalling to occur at the remoting layer and there is object replacement via replaceObject, proxy replacement, etc., the marshaller needs the handler TCL saved for the duration of the response. Is there a way the handler can associate that with the response object?
|
You mean so that the client can pick the right classloader to unmarshal the response? I think that clients should also be associated with a CL as well (anyway we need to do that to allow us to specify a RemoteClassLoader on the client side). I doubt there is likely to be a 1:1 correspondence between classloaders on the client and server side, so I don't really see the benefit of annotating the response with classloader information.ju
Setting the TCL for the duration of any task that handles a request is doable though. There are currently no plans to implement any form of lazy unmarshalling. We will need to ensure that the streaming facility can have access to the marshaller as well as the classloader.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4169298#4169298
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4169298
17 years, 8 months