[
https://issues.jboss.org/browse/JGRP-1860?page=com.atlassian.jira.plugin....
]
Dennis Reed commented on JGRP-1860:
-----------------------------------
BTW: there is no objectFromByteBuffer() method in 3.2.13, only
objectToBuffer(). Are we looking at different versions
(I'm looking at tag JGroups-3.2.13.Final) ?
Sorry about that, I've been looking at it in different versions. The method was
objectFromByteBuffer in earlier versions, but was renamed to objectFromBuffer. (and the
same for objectTo*Buffer).
So you want an implementer of a custom marshaller to be able to
(re)use the {{Util.objectToFromBuffer()} methods, but still be
able to pass in a class loader ? This in order to prevent having to implement something
equivalent themselves ?
That's correct.
Since the classloader is currently hard-coded, the entire marshalling code has to be
reproduced in a custom marshaller.
With an additional request to be able to set a ClassLoader on RpcDispatcher and have it
just handle it, to also skip the step of creating a custom marshaller.
(In a non-flat classloader environment, setting the classloader would be a common need for
users of RpcDispatcher, so it should be as simple as possible).
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)