Questo contenuto non è disponibile nella lingua selezionata.

6.4. Custom Externalizer ID Values


Advanced externalizers can be assigned custom IDs if desired. Some ID ranges are reserved for other modules or frameworks and must be avoided:
Expand
Table 6.1. Reserved Externalizer ID Ranges
ID Range Reserved For
1000-1099 The Infinispan Tree Module
1100-1199 Red Hat JBoss Data Grid Server modules
1200-1299 Hibernate Infinispan Second Level Cache
1300-1399 JBoss Data Grid Lucene Directory
1400-1499 Hibernate OGM
1500-1599 Hibernate Search
1600-1699 Infinispan Query Module
1700-1799 Infinispan Remote Query Module

6.4.1. Customize the Externalizer ID (Declaratively)

Customize the advanced externalizer ID declaratively (via XML) as follows:

Procedure 6.2. Customizing the Externalizer ID (Declaratively)

  1. Add the global element to the infinispan element:
    <infinispan>
      <global />
    </infinispan>
    Copy to Clipboard Toggle word wrap
  2. Add the serialization element to the global element as follows:
    <infinispan>
      <global>
        <serialization />
      </global>
    </infinispan>
    Copy to Clipboard Toggle word wrap
  3. Add the advancedExternalizer element to add information about the new advanced externalizer as follows:
    <infinispan>
      <global>
        <serialization>
          <advancedExternalizer />
        </serialization>
      </global>
    </infinispan>
    Copy to Clipboard Toggle word wrap
  4. Define the externalizer ID using the id attribute as follows:
    <infinispan>
      <global>
        <serialization>
          <advancedExternalizers>
           <advancedExternalizer id="$ID" />
          </advancedExternalizers>
        </serialization>
      </global>
    </infinispan>
    Copy to Clipboard Toggle word wrap
    Ensure that the selected ID is not from the range of IDs reserved for other modules.
  5. Define the externalizer class using the externalizerClass attribute as follows:
    <infinispan>
      <global>
        <serialization>
          <advancedExternalizers>
           <advancedExternalizer id="$ID" externalizerClass="org.infinispan.marshall.AdvancedExternalizerTest$IdViaConfigObj$Externalizer"/>
           </advancedExternalizers>
        </serialization>    
      </global>
    </infinispan>
    Copy to Clipboard Toggle word wrap
    Replace the $IdViaAnnotationObj and $AdvancedExternalizer values as required.

6.4.2. Customize the Externalizer ID (Programmatically)

Use the following configuration to programmatically assign a specific ID to the externalizer:

Example 6.5. Assign an ID to the Externalizer

GlobalConfiguration globalConfiguration = new GlobalConfigurationBuilder()
            .serialization()
               .addAdvancedExternalizer($ID, new Person.PersonExternalizer())
            .build();
Copy to Clipboard Toggle word wrap
Replace the $ID with the desired ID.
Torna in cima
Red Hat logoGithubredditYoutubeTwitter

Formazione

Prova, acquista e vendi

Community

Informazioni sulla documentazione di Red Hat

Aiutiamo gli utenti Red Hat a innovarsi e raggiungere i propri obiettivi con i nostri prodotti e servizi grazie a contenuti di cui possono fidarsi. Esplora i nostri ultimi aggiornamenti.

Rendiamo l’open source più inclusivo

Red Hat si impegna a sostituire il linguaggio problematico nel codice, nella documentazione e nelle proprietà web. Per maggiori dettagli, visita il Blog di Red Hat.

Informazioni su Red Hat

Forniamo soluzioni consolidate che rendono più semplice per le aziende lavorare su piattaforme e ambienti diversi, dal datacenter centrale all'edge della rete.

Theme

© 2025 Red Hat