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

Denis Magda commented on IGNITE-1272:
-------------------------------------

Val, thanks for the review.

1) Also why you get the descriptor from the userTypes map, but return it only 
if was loaded by default loader?

Because if it's a custom class loader like {{GridDeploymentClassLoader}} we 
have to give him a chance to reload a class. It least this is required for 
compute engine to be fully workable in conjunction with {{PortableMarshaller}}.

2) Why do we need it in this map then?

We store class descriptors of custom class loaders in a map for cases when it 
wasn't possible to load a class from the cache ({{marshCtx.getClass}}).
It may happen when during serialization we don't manage to register it in the 
cache {{registered = marshCtx.registerClass(typeId, cls)}} and write full class 
name into the serialization form. When it's time to deserialize such a object 
we won't be able to get its class from {{marshCtx.getClass}} but will be able 
from {{userTypes}}.

3) I'm not sure I understood the purpose of {{descriptorLoadingFailover(...)}} 
method. 

First, it's is needed for the reason described in 2).

Second. The user may register types with {{PortableTypeConfiguration}}. Most 
likely class descriptors registered this way will be bound to default class 
loader in {{userTypes}}.
Then there can be a case when {{CacheClassLoader}} tries to deserialize on 
object of a type registered with {{PortableTypeConfiguration}}. 
{{CacheClassLoader}} won't be able to load this class (it seems that it doesn't 
perform lookup in the classpath) and {{descriptorLoadingFailover(...)}} will 
try to find class descriptor using the default class loader.

> PortableMarshaller: issues when different class loaders are used
> ----------------------------------------------------------------
>
>                 Key: IGNITE-1272
>                 URL: https://issues.apache.org/jira/browse/IGNITE-1272
>             Project: Ignite
>          Issue Type: Bug
>    Affects Versions: ignite-1.4
>            Reporter: Denis Magda
>            Assignee: Denis Magda
>            Priority: Blocker
>             Fix For: ignite-1.5
>
>         Attachments: ignite-1272.patch
>
>
> The reason is that a loader is not passed to required places when needed.
> Reproduced with the following tests:
> - {{IgniteCacheAbstractExecutionContextTest.testUserClassLoader()}} fails 
> with PortableMarshaller enabled.
> - {{GridDeploymentMessageCountSelfTest.testCacheValueDeploymentOnPut()}}
> Another issue is when {{PortableContext}} returns {{PortableClassDescriptor}} 
> by type id. Returned descriptor has a constructor which already has been 
> loaded with another class loader. Fix is not trivial and issue is reproduced 
> with {{GridP2PRemoteClassLoadersSelfTest}}
> Look for corresponding TODOs in the code.
> Unmute tests when fixed



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

Reply via email to