DomainFilterInterceptor (Apache Tomcat 9.0.120 API Documentation)
Description: declaration: package: org.apache.catalina.tribes.group.interceptors, class: DomainFilterInterceptor

# Class DomainFilterInterceptor

java.lang.Object
org.apache.catalina.tribes.group.ChannelInterceptorBase
org.apache.catalina.tribes.group.interceptors.DomainFilterInterceptor

All Implemented Interfaces:
  `ChannelInterceptor, DomainFilterInterceptorMBean, Heartbeat, MembershipListener`

public class DomainFilterInterceptor extends ChannelInterceptorBase implements DomainFilterInterceptorMBean
Filters membership based on domain.

- ## Nested Class Summary

  ### Nested classes/interfaces inherited from interface ChannelInterceptor

  `ChannelInterceptor.InterceptorEvent`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected byte[]`
  `domain`
  The domain filter byte array.
  `protected int`
  `logInterval`
  The interval for logging rejected messages.
  `protected Membership`
  `membership`
  The membership store for tracking members in the filtered domain.
  `protected static final StringManager`
  `sm`
  String manager for this class.

  ### Fields inherited from class ChannelInterceptorBase

  `optionFlag`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DomainFilterInterceptor()`
  Construct a new DomainFilterInterceptor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `byte[]`
  `getDomain()`
  Get the domain filter.
  `Member`
  `getLocalMember(boolean incAlive)`
  Intercepts the `Channel.getLocalMember(boolean)` method
  `int`
  `getLogInterval()`
  Get the log interval.
  `Member`
  `getMember(Member mbr)`
  Intercepts the `Channel.getMember(Member)` method
  `Member[]`
  `getMembers()`
  Intercepts the `Channel.getMembers()` method
  `boolean`
  `hasMembers()`
  Intercepts the `Channel.hasMembers()` method
  `void`
  `memberAdded(Member member)`
  A member was added to the group
  `void`
  `memberDisappeared(Member member)`
  A member was removed from the group
  If the member left voluntarily, the Member.getCommand will contain the Member.SHUTDOWN_PAYLOAD data
  `void`
  `messageReceived(ChannelMessage msg)`
  The `messageReceived` is invoked when a message is received.
  `void`
  `setDomain(byte[] domain)`
  Set the domain filter as a byte array.
  `void`
  `setDomain(String domain)`
  Set the domain filter as a String.
  `void`
  `setLogInterval(int logInterval)`
  Set the log interval.
  `protected void`
  `setupMembership()`
  Initialize the membership store if not already set.

  ### Methods inherited from class ChannelInterceptorBase

  `fireInterceptorEvent, getChannel, getNext, getOptionFlag, getPrevious, heartbeat, okToProcess, sendMessage, setChannel, setNext, setOptionFlag, setPrevious, start, stop`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface DomainFilterInterceptorMBean

  `getOptionFlag`

- ## Field Details

  - ### sm

    protected static final StringManager sm
    String manager for this class.

  - ### membership

    protected volatile Membership membership
    The membership store for tracking members in the filtered domain.

  - ### domain

    protected byte[] domain
    The domain filter byte array.

  - ### logInterval

    protected int logInterval
    The interval for logging rejected messages.

- ## Constructor Details

  - ### DomainFilterInterceptor

    public DomainFilterInterceptor()
    Construct a new DomainFilterInterceptor.

- ## Method Details

  - ### messageReceived

    public void messageReceived(ChannelMessage msg)
    Description copied from interface: `ChannelInterceptor`
    The `messageReceived` is invoked when a message is received. `ChannelMessage.getAddress()` is the sender, or the reply-to address if it has been overwritten.
    Specified by:
      `messageReceived` in interface `ChannelInterceptor`
    Overrides:
      `messageReceived` in class `ChannelInterceptorBase`
    Parameters:
      `msg` - ChannelMessage

  - ### memberAdded

    public void memberAdded(Member member)
    Description copied from interface: `MembershipListener`
    A member was added to the group
    Specified by:
      `memberAdded` in interface `MembershipListener`
    Overrides:
      `memberAdded` in class `ChannelInterceptorBase`
    Parameters:
      `member` - Member - the member that was added

  - ### memberDisappeared

    public void memberDisappeared(Member member)
    Description copied from interface: `MembershipListener`
    A member was removed from the group
    If the member left voluntarily, the Member.getCommand will contain the Member.SHUTDOWN_PAYLOAD data
    Specified by:
      `memberDisappeared` in interface `MembershipListener`
    Overrides:
      `memberDisappeared` in class `ChannelInterceptorBase`
    Parameters:
      `member` - Member
    See Also:
      - `Member.SHUTDOWN_PAYLOAD`

  - ### hasMembers

    public boolean hasMembers()
    Description copied from interface: `ChannelInterceptor`
    Intercepts the `Channel.hasMembers()` method
    Specified by:
      `hasMembers` in interface `ChannelInterceptor`
    Overrides:
      `hasMembers` in class `ChannelInterceptorBase`
    Returns:
      boolean - if the channel has members in its membership group
    See Also:
      - `Channel.hasMembers()`

  - ### getMembers

    public Member[] getMembers()
    Description copied from interface: `ChannelInterceptor`
    Intercepts the `Channel.getMembers()` method
    Specified by:
      `getMembers` in interface `ChannelInterceptor`
    Overrides:
      `getMembers` in class `ChannelInterceptorBase`
    Returns:
      the members
    See Also:
      - `Channel.getMembers()`

  - ### getMember

    public Member getMember(Member mbr)
    Description copied from interface: `ChannelInterceptor`
    Intercepts the `Channel.getMember(Member)` method
    Specified by:
      `getMember` in interface `ChannelInterceptor`
    Overrides:
      `getMember` in class `ChannelInterceptorBase`
    Parameters:
      `mbr` - Member
    Returns:
      Member - the actual member information, including stay alive
    See Also:
      - `Channel.getMember(Member)`

  - ### getLocalMember

    public Member getLocalMember(boolean incAlive)
    Description copied from interface: `ChannelInterceptor`
    Intercepts the `Channel.getLocalMember(boolean)` method
    Specified by:
      `getLocalMember` in interface `ChannelInterceptor`
    Overrides:
      `getLocalMember` in class `ChannelInterceptorBase`
    Parameters:
      `incAlive` - boolean
    Returns:
      the member that represents this node
    See Also:
      - `Channel.getLocalMember(boolean)`

  - ### setupMembership

    protected void setupMembership()
    Initialize the membership store if not already set.

  - ### getDomain

    public byte[] getDomain()
    Description copied from interface: `DomainFilterInterceptorMBean`
    Get the domain filter.
    Specified by:
      `getDomain` in interface `DomainFilterInterceptorMBean`
    Returns:
      the domain byte array

  - ### setDomain

    public void setDomain(byte[] domain)
    Set the domain filter as a byte array.
    Parameters:
      `domain` - The domain byte array

  - ### setDomain

    public void setDomain(String domain)
    Set the domain filter as a String.
    Parameters:
      `domain` - The domain string, either in "{...}" format or plain text

  - ### getLogInterval

    public int getLogInterval()
    Description copied from interface: `DomainFilterInterceptorMBean`
    Get the log interval.
    Specified by:
      `getLogInterval` in interface `DomainFilterInterceptorMBean`
    Returns:
      the log interval

  - ### setLogInterval

    public void setLogInterval(int logInterval)
    Description copied from interface: `DomainFilterInterceptorMBean`
    Set the log interval.
    Specified by:
      `setLogInterval` in interface `DomainFilterInterceptorMBean`
    Parameters:
      `logInterval` - The new log interval