6.4.4. Registering Advanced Externalizers


In JBoss Data Grid, AdvancedExternalizer implementation can be registered using XML or Programmatic configuration, or via annotation.
An Advanced Externalizer implementation for Person object stored as a static inner class can be configured programmatically or declaratively.
Declarative Configuration:

The following is an example of a declarative configuration for an advanced Externalizer implementation:

<infinispan>
  <global>
    <serialization>
      <advancedExternalizers>
        <advancedExternalizer externalizerClass="Person$PersonExternalizer"/>
      </advancedExternalizers>
    </serialization>
  </global>
  ...
</infinispan>
Programmatic Configuration:

The following is an example of a programmatic configuration for an advanced Externalizer implementation:

GlobalConfigurationBuilder builder = ...
builder.serialization()
   .addAdvancedExternalizer(new Person.PersonExternalizer());
An AdvancedExternalizer implementation must be associated with an identifier, regardless of the configuration method used.
If an identifier in an AdvancedExternalizer implementation is defined using both XML/Programmatic configuration as well as annotation, XML/Programmatic defined value will be used.
The following example shows an Externalizer where the identifier is defined at the time of registration:
Declarative Configuration:

The following is a declarative configuration for the location of the identifier definition during registration:

<infinispan>
  <global>
    <serialization>
      <advancedExternalizers>
        <advancedExternalizer id="123"
                              externalizerClass="Person$PersonExternalizer"/>
      </advancedExternalizers>
    </serialization>
  </global>
  ...
</infinispan>
Programmatic Configuration:

The following is a programmatic configuration for the location of the identifier definition during registration:

GlobalConfigurationBuilder builder = ...
builder.serialization()
   .addAdvancedExternalizer(123, new Person.PersonExternalizer());
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.