[
https://issues.apache.org/jira/browse/IGNITE-2947?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15232125#comment-15232125
]
Denis Magda commented on IGNITE-2947:
-------------------------------------
Anton, the fix is not full. You have to merge it at least with my changes.
If run GridBinaryMarshallerCtxDisabledSelfTest with custom loader set in the
configuration then the test should fail (see this from your changes).
In any case presently BinaryClassDescriptor with custom serializer and mapper
has to be placed in "userType" map of every node. Otherwise BinaryConfiguration
will mismatch and we should raise (?) an exception on node join.
Thus there is actually no reason to register class in the marshaller context as
Alex suggested because every node will already have it in "userMap".
If I'm wrong in some point I would discuss this the next week in order to
rework the implementaiton further if needed.
> BinaryContext doesn't honor custom loader set through
> IgniteConfiguration.classLoader
> -------------------------------------------------------------------------------------
>
> Key: IGNITE-2947
> URL: https://issues.apache.org/jira/browse/IGNITE-2947
> Project: Ignite
> Issue Type: Bug
> Components: binary
> Affects Versions: 1.5.0.final
> Reporter: Denis Magda
> Assignee: Anton Vinogradov
> Priority: Critical
> Labels: community, important
> Fix For: 1.6
>
>
> If to register a specific object with {{BinaryTypeConfiguration}} setting its
> {{typeName}} and load Class of objects of this type using a custom class
> loader passed to {{IgniteConfiguration.classLoader}} then at
> {{BinaryContext}} initialization time the context will not properly register
> this {{BinaryTypeConfiguration}} because it doesn't suppose that the Class of
> the type can be loaded by the custom class loader
> In the code below {{Class.forName}} has to use
> {{IgniteConfiguration.classLoader}} if the latest is set and fall back to
> {{dfltLdr}} otherwise.
> {noformat}
> @SuppressWarnings("ErrorNotRethrown")
> public void registerUserType(String clsName,
> BinaryInternalMapper mapper,
> @Nullable BinarySerializer serializer,
> @Nullable String affKeyFieldName,
> boolean isEnum)
> throws BinaryObjectException {
> assert mapper != null;
> Class<?> cls = null;
> try {
> cls = Class.forName(clsName);
> }
> catch (ClassNotFoundException | NoClassDefFoundError ignored) {
> // No-op.
> }
> {noformat}
> Also there are several conditions in {{BinaryContext}} that are done for
> {{dfltLdr}}. The same conditions have to be executed for
> {{IgniteConfiguration.classLoader}}.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)