A newer version of Hazelcast Platform is available.

View latest

Overriding the Built-in Serializers

As mentioned in the previous page, you cannot override the built-in serializers by default. Yet, you can use allowOverrideDefaultSerializers when using programmatic configuration or allow-override-default-serializers when using the declarative one to specify whether the built-in serializers will be overridden:

  • XML

  • YAML

  • Java

<hazelcast>
    <serialization>
        <allow-override-default-serializers>true</allow-override-default-serializers>
    </serialization>
</hazelcast>
hazelcast:
    serialization:
        allow-override-default-serializers: true
SerializationConfig{
  boolean isAllowOverrideDefaultSerializers();

  SerializationConfig setAllowOverrideDefaultSerializers(final boolean allowOverrideDefaultSerializers);}

You should use this configuration cautiously. Built-in serializers are used heavily by the Hazelcast internally. If any of the instances in a cluster overrides a built-in serializer, all the members and clients in that cluster must override it with the same serializer. This configuration is specifically for the following cases:

  • You implement a a custom serialization configuration by the user for a type

  • Hazelcast adds a built-in serializer for the same type in a future release.

To be able to support rolling upgrade from an old version, you need to make sure of the backward compatibility of the serialization. As a solution, you can set this property on the new version so that the new instances can override the new built-in serializers with their existing custom ones.