[ 
https://issues.apache.org/jira/browse/IGNITE-2894?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15211981#comment-15211981
 ] 

Andrey Kornev commented on IGNITE-2894:
---------------------------------------

Just for completeness, here's a copy of my posting from the dev list related to 
this subject.

{quote}
Ignite Serialization should follow the approach similar to what Java 
serialization does: it can transparently and consistently handle both 
Serializable and Externalizable classes. It can do it because it relies on a 
single class - ObjectOutputStream - to do serialization (and a single class - 
ObjectInputStream - to do the opposite, but let's ignore it for the moment). 
ObjectOutputStream delegates to proper user callbacks (writeObject or 
writeExternal) at the right moments, but otherwise it fully controls the 
on-the-wire representation and takes care of all the necessary stream 
framing/marking so that ObjectInputStream can then correctly deserialize the 
bytes. It's never a problem for Java to serialize an Externalizable field from 
a Serializable object and vice versa. Users can mix and match serialization 
APIs as they please.

Ignite should just have a single marshaller, let's say the Binary, which drives 
the whole serialization process. It doesn't delegate to OptimizedMarshaller as 
it does today. Instead it detects the Serializable/Externalizable classes and 
calls their serialization callbacks - writeObject/writeExternal - passing in 
*itself* as ObjectOutputStream/ObjectOutput correspondingly. This way the 
entire serialization process never leaves the context of a single Binary 
marshaller and allows Ignite to handle any combination of serialization types 
(Binary, Externalizable, Serializable) seamlessly.
{quote}

> Binary object inside of Externalizable still serialized with 
> OptimizedMarshaller
> --------------------------------------------------------------------------------
>
>                 Key: IGNITE-2894
>                 URL: https://issues.apache.org/jira/browse/IGNITE-2894
>             Project: Ignite
>          Issue Type: Bug
>          Components: general
>    Affects Versions: 1.5.0.final
>            Reporter: Valentin Kulichenko
>            Priority: Critical
>              Labels: community, customer, important
>             Fix For: 1.6
>
>
> When binary marshaller meets an Externalizable object, it switches to 
> optimized marshaller. And if there is a regular object inside, it's still 
> serialized with optimized, even if its type is declared in binary 
> configuration with custom mapper, etc.
> Essentially, binary marshaller should fully support Java serialization, 
> including {{Externalizable}} and {{writeObject}}/{{readObject}}.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to