Package org.apache.catalina.tribes.group.interceptors

## Class StaticMembershipInterceptor

- java.lang.Object
- - org.apache.catalina.tribes.group.ChannelInterceptorBase
  - - org.apache.catalina.tribes.group.interceptors.StaticMembershipInterceptor

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

    public class StaticMembershipInterceptor
    extends ChannelInterceptorBase
    implements StaticMembershipInterceptorMBean

### Nested Class Summary

### Nested classes/interfaces inherited from interface org.apache.catalina.tribes.ChannelInterceptor

`ChannelInterceptor.InterceptorEvent`

### Field Summary

Fields
`protected Member` `localMember`
`protected static byte[]` `MEMBER_START`
`protected static byte[]` `MEMBER_STOP`
`protected java.util.ArrayList<Member>` `members`
`protected static StringManager` `sm`

### Fields inherited from class org.apache.catalina.tribes.group.ChannelInterceptorBase

`optionFlag`

### Constructor Summary

Constructors
`StaticMembershipInterceptor()`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `addStaticMember​(Member member)`
`protected ChannelInterceptor` `getfirstInterceptor()`
`Member` `getLocalMember​(boolean incAlive)` Return the member that represents this node.
`Member` `getMember​(Member mbr)` Intercepts the `Channel.getMember(Member)` method
`Member[]` `getMembers()` Get all current cluster members
`boolean` `hasMembers()` has members
`void` `messageReceived​(ChannelMessage msg)` the `messageReceived` is invoked when a message is received.
`void` `removeStaticMember​(Member member)`
`protected void` `sendLocalMember​(Member[] members)`
`protected void` `sendMemberMessage​(Member[] members, byte[] message)`
`protected void` `sendShutdown​(Member[] members)`
`void` `setLocalMember​(Member member)`
`void` `start​(int svc)` Starts up the channel.
`void` `stop​(int svc)` Shuts down the channel.

### Methods inherited from class org.apache.catalina.tribes.group.ChannelInterceptorBase

`fireInterceptorEvent, getChannel, getNext, getOptionFlag, getPrevious, heartbeat, memberAdded, memberDisappeared, okToProcess, sendMessage, setChannel, setNext, setOptionFlag, setPrevious`

### Methods inherited from class java.lang.Object

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

### Methods inherited from interface org.apache.catalina.tribes.group.interceptors.StaticMembershipInterceptorMBean

`getOptionFlag`

### Field Detail

#### sm

    protected static final StringManager sm

#### MEMBER_START

    protected static final byte[] MEMBER_START

#### MEMBER_STOP

    protected static final byte[] MEMBER_STOP

#### members

    protected final java.util.ArrayList<Member> members

#### localMember

    protected Member localMember

### Constructor Detail

#### StaticMembershipInterceptor

    public StaticMembershipInterceptor()

### Method Detail

#### addStaticMember

    public void addStaticMember​(Member member)

#### removeStaticMember

    public void removeStaticMember​(Member member)

#### setLocalMember

    public void setLocalMember​(Member member)

#### 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

#### hasMembers

    public boolean hasMembers()

has members

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()

Get all current cluster members

Specified by:
  `getMembers` in interface `ChannelInterceptor`
Overrides:
  `getMembers` in class `ChannelInterceptorBase`
Returns:
  all members or empty array
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
See Also:
  `Channel.getMember(Member)`

#### getLocalMember

    public Member getLocalMember​(boolean incAlive)

Return the member that represents this node.

Specified by:
  `getLocalMember` in interface `ChannelInterceptor`
Specified by:
  `getLocalMember` in interface `StaticMembershipInterceptorMBean`
Overrides:
  `getLocalMember` in class `ChannelInterceptorBase`
Parameters:
  `incAlive` - boolean
Returns:
  Member
See Also:
  `Channel.getLocalMember(boolean)`

#### start

    public void start​(int svc)
               throws ChannelException

Starts up the channel. This can be called multiple times for individual services to start The svc parameter can be the logical or value of any constants

Sends notifications upwards.

Specified by:
  `start` in interface `ChannelInterceptor`
Overrides:
  `start` in class `ChannelInterceptorBase`
Parameters:
  `svc` - int value of
  DEFAULT - will start all services
  MBR_RX_SEQ - starts the membership receiver
  MBR_TX_SEQ - starts the membership broadcaster
  SND_TX_SEQ - starts the replication transmitter
  SND_RX_SEQ - starts the replication receiver
Throws:
  `ChannelException` - if a startup error occurs or the service is already started.
See Also:
  `Channel`

#### stop

    public void stop​(int svc)
              throws ChannelException

Shuts down the channel. This can be called multiple times for individual services to shutdown The svc parameter can be the logical or value of any constants

Sends local member shutdown.

Specified by:
  `stop` in interface `ChannelInterceptor`
Overrides:
  `stop` in class `ChannelInterceptorBase`
Parameters:
  `svc` - int value of
  DEFAULT - will shutdown all services
  MBR_RX_SEQ - stops the membership receiver
  MBR_TX_SEQ - stops the membership broadcaster
  SND_TX_SEQ - stops the replication transmitter
  SND_RX_SEQ - stops the replication receiver
Throws:
  `ChannelException` - if a startup error occurs or the service is already started.
See Also:
  `Channel`

#### sendLocalMember

    protected void sendLocalMember​(Member[] members)

#### sendShutdown

    protected void sendShutdown​(Member[] members)

#### getfirstInterceptor

    protected ChannelInterceptor getfirstInterceptor()

#### sendMemberMessage

    protected void sendMemberMessage​(Member[] members,
                                     byte[] message)
                              throws ChannelException

Throws:
  `ChannelException`