Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.

37.2. Adding Custom Interceptors Declaratively


Each named cache in Red Hat JBoss Data Grid has its own interceptor stack. As a result, custom interceptors can be added on a per named cache basis.
A custom interceptor can be added using XML. Use the following procedure to add custom interceptors.

Procedure 37.1. Adding Custom Interceptors

<local-cache name="cacheWithCustomInterceptors">
   <custom-interceptors>
      <interceptor position="FIRST" class="com.mycompany.CustomInterceptor1">
        <property name="attributeOne" value="value1" />
        <property name="attributeTwo" value="value2" />
      </interceptor>
      <interceptor position="LAST" class="com.mycompany.CustomInterceptor2"/>
      <interceptor index="3" class="com.mycompany.CustomInterceptor1"/>
      <interceptor before="org.infinispan.interceptors.CallInterceptor" class="com.mycompany.CustomInterceptor2"/>
      <interceptor after="org.infinispan.interceptors.CallInterceptor" class="com.mycompany.CustomInterceptor1"/>
   </customInterceptors>
</local-cache>
Copy to Clipboard Toggle word wrap
  1. Define Custom Interceptors

    All custom interceptors must extend org.infinispan.interceptors.base.BaseCustomInterceptor.
  2. Define the Position of the New Custom Interceptor

    Interceptors must have a defined position. These options are mutually exclusive, meaning an interceptor cannot have both a position attribute and index attribute. Valid options are:
    • via Position Attribute

      • FIRST - Specifies that the new interceptor is placed first in the chain.
      • LAST - Specifies that the new interceptor is placed last in the chain.
      • OTHER_THAN_FIRST_OR_LAST - Specifies that the new interceptor can be placed anywhere except first or last in the chain.
    • via Index Attribute

      • The index identifies the position of this interceptor in the chain. This index begins at 0, being the first position in the chain, and goes up to a number of interceptors in a given configuration.
    • via Before or After Attributes

      • The after attributes places the new interceptor directly after the instance of the named interceptor, specified via its fully qualified class name.
      • The before attribute places the new interceptor directly before the instance of the named interceptor, specified via its fully qualified class name.
    • Define Interceptor Properties

      Define specific interceptor properties.
  3. Apply Other Custom Interceptors

    In this example, the next custom interceptor is called CustomInterceptor2.

Note

Custom interceptors with the position OTHER_THAN_FIRST_OR_LAST may cause the CacheManager to fail.

Note

This configuration is only valid for JBoss Data Grid's Library Mode.
Nach oben
Red Hat logoGithubredditYoutubeTwitter

Lernen

Testen, kaufen und verkaufen

Communitys

Über Red Hat Dokumentation

Wir helfen Red Hat Benutzern, mit unseren Produkten und Diensten innovativ zu sein und ihre Ziele zu erreichen – mit Inhalten, denen sie vertrauen können. Entdecken Sie unsere neuesten Updates.

Mehr Inklusion in Open Source

Red Hat hat sich verpflichtet, problematische Sprache in unserem Code, unserer Dokumentation und unseren Web-Eigenschaften zu ersetzen. Weitere Einzelheiten finden Sie in Red Hat Blog.

Über Red Hat

Wir liefern gehärtete Lösungen, die es Unternehmen leichter machen, plattform- und umgebungsübergreifend zu arbeiten, vom zentralen Rechenzentrum bis zum Netzwerkrand.

Theme

© 2025 Red Hat