A discussion about real-world modularity
David M. Lloyd
david.lloyd at redhat.com
Thu May 10 07:10:25 PDT 2012
On 05/10/2012 08:45 AM, Alan Bateman wrote:
> On 09/05/2012 19:22, David M. Lloyd wrote:
>> Some of you might find this interesting:
>>
>> http://lists.jboss.org/pipermail/jboss-as7-dev/2012-May/005974.html
> The references to serialization are interesting as we need update
> serialization to work with modules. I can't quite tell from the link
> whether you are using the standard serialization protocol or something
> else. If it is the standard serialization protocol then I'm curious how
> you get the class loader identity into the stream.
Yes, and no. This refers to my JBoss Marshalling project which is an
alternative serialization API with more optimized implementations - it
conforms to the spec in terms of serializable objects but has a number
of extensions as well. There are two implementations at the moment - a
JDK-compatible protocol as well as a more optimized (for space and
speed) protocol.
Either way the class data is written using a class resolver. This is
basically equivalent to overriding
ObjectInputStream#resolve[Proxy]Class() and
ObjectOutputStream#annotate[Proxy]Class(). The module identity is
written out and re-read and used to select the appropriate class loader.
Note that as I state in that mailing, this is often, but not *always*
preferred behavior, especially when you have different module environments.
--
- DML
More information about the jigsaw-dev
mailing list