[jboss-jira] [JBoss JIRA] (JGRP-1860) Custom classloader in RpcDispatcher

Bela Ban (JIRA) issues at jboss.org
Tue Jul 22 06:47:29 EDT 2014


    [ https://issues.jboss.org/browse/JGRP-1860?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12986958#comment-12986958 ] 

Bela Ban edited comment on JGRP-1860 at 7/22/14 6:46 AM:
---------------------------------------------------------

Are you sure that setting a classloader in RpcDispatcher to be used to deserialize requests is a good idea ? AFAICS, ObjectInputStream.resolveClass(), when passed in a classloader, does not attempt to walk a CL chain when a user-defined class is not found.
So I'm not sure that setting a single classloader to be used for all requests in {{RpcDispatcher.handle()}} is a good idea...
I think adding the classloader ar parameter to the objectFromXXX() methods is good enough.

BTW: setting a classloader in RpcDispatcher would also require setting one in RequestCorrelator, too...

Thoughts ?


was (Author: belaban):
Are you sure that setting a classloader in RpcDispatcher to be used to deserialize requests is a good idea ? AFAICS, ObjectInputStream.resolveClass(), when passed in a classloader, does not attempt to walk a CL chain when a user-defined class is not found.
So I'm not sure that setting a single classloader to be used for all requests in {{RpcDispatcher.handle()}} is a good idea...

BTW: setting a classloader in RpcDispatcher would also require setting one in RequestCorrelator, too...

Thoughts ?

> Custom classloader in RpcDispatcher
> -----------------------------------
>
>                 Key: JGRP-1860
>                 URL: https://issues.jboss.org/browse/JGRP-1860
>             Project: JGroups
>          Issue Type: Feature Request
>      Security Level: Public(Everyone can see) 
>    Affects Versions: 3.2.13
>            Reporter: Dennis Reed
>            Assignee: Bela Ban
>             Fix For: 3.5
>
>
> RpcDispatcher is hard-coded to use JGroups' classloader when marshalling the users's custom objects over RPC.
> RpcDispatcher uses Util.objectFromByteBuffer to unmarshall, which uses an ObjectInputStream.  ObjectInputStream uses the classloader of its caller's class (Util).
> RpcDispatcher does allow a custom marshaller to be used (implementing RpcDispatcher.Marshaller), but since Util.objectFromByteBuffer hard-codes the use of ObjectInputStream, a custom marshaller cannot simply set the classloader and then delegate back to the default JGroups code.
> Util.objectFromBuffer should be enhanced to use a custom ObjectInputStream implementation that overrides resolveClass to use a custom classloader, and an API should be added to RpcDispatcher to pass in the classloader to use.



--
This message was sent by Atlassian JIRA
(v6.2.6#6264)


More information about the jboss-jira mailing list