Package org.apache.catalina.tribes.membership

## Class StaticMembershipProvider

- java.lang.Object
- - org.apache.catalina.tribes.membership.MembershipProviderBase
  - - org.apache.catalina.tribes.membership.StaticMembershipProvider

All Implemented Interfaces:
  `ChannelListener`, `RpcCallback`, `Heartbeat`, `MembershipProvider`

    public class StaticMembershipProvider
    extends MembershipProviderBase
    implements RpcCallback, ChannelListener, Heartbeat

### Nested Class Summary

Nested Classes
`static class` `StaticMembershipProvider.MemberMessage`
`protected class` `StaticMembershipProvider.PingThread`

### Field Summary

Fields
`protected Channel` `channel`
`protected int` `connectTimeout`
`protected long` `expirationTime`
`protected long` `pingInterval`
`protected RpcChannel` `rpcChannel`
`protected long` `rpcTimeout`
`protected boolean` `running`
`protected int` `sendOptions`
`protected static StringManager` `sm`
`protected int` `startLevel`
`protected ArrayList<StaticMember>` `staticMembers`
`protected StaticMembershipProvider.PingThread` `thread`
`protected boolean` `useThread`

### Fields inherited from class org.apache.catalina.tribes.membership.MembershipProviderBase

`executor, membership, membershipListener, service`

### Constructor Summary

Constructors
`StaticMembershipProvider()`

### Method Summary

All Methods Instance Methods Concrete Methods
`boolean` `accept​(Serializable msg, Member sender)` Invoked by the channel to determine if the listener will process this message or not.
`protected void` `checkExpired()`
`void` `heartbeat()` Heartbeat invocation for resources cleanup etc
`void` `init​(Properties properties)`
`void` `leftOver​(Serializable msg, Member sender)` If the reply has already been sent to the requesting thread, the rpc callback can handle any data that comes in after the fact.
`protected void` `memberAdded​(Member member)`
`protected void` `memberAlive​(Member member)`
`protected void` `memberDisappeared​(Member member)`
`void` `messageReceived​(Serializable msg, Member sender)` Receive a message from the channel
`protected void` `ping()`
`Serializable` `replyRequest​(Serializable msg, Member sender)` Allows sending a response to a received message.
`void` `setChannel​(Channel channel)`
`void` `setStaticMembers​(ArrayList<StaticMember> staticMembers)`
`protected Member` `setupMember​(Member mbr)`
`void` `start​(int level)`
`protected void` `startMembership​(Member[] members)`
`boolean` `stop​(int level)`
`protected void` `stopMembership​(Member[] members)`

### Methods inherited from class org.apache.catalina.tribes.membership.MembershipProviderBase

`getMember, getMembers, hasMembers, setMembershipListener, setMembershipService`

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

`equals, hashCode`

### Field Detail

#### sm

    protected static final StringManager sm

#### channel

    protected Channel channel

#### rpcChannel

    protected RpcChannel rpcChannel

#### staticMembers

    protected ArrayList<StaticMember> staticMembers

#### sendOptions

    protected int sendOptions

#### expirationTime

    protected long expirationTime

#### connectTimeout

    protected int connectTimeout

#### rpcTimeout

    protected long rpcTimeout

#### startLevel

    protected int startLevel

#### useThread

    protected boolean useThread

#### pingInterval

    protected long pingInterval

#### running

    protected volatile boolean running

#### thread

    protected StaticMembershipProvider.PingThread thread

### Constructor Detail

#### StaticMembershipProvider

    public StaticMembershipProvider()

### Method Detail

#### init

    public void init​(Properties properties)
              throws Exception

Specified by:
  `init` in interface `MembershipProvider`
Overrides:
  `init` in class `MembershipProviderBase`
Throws:
  `Exception`

#### start

    public void start​(int level)
               throws Exception

Specified by:
  `start` in interface `MembershipProvider`
Throws:
  `Exception`

#### stop

    public boolean stop​(int level)
                 throws Exception

Specified by:
  `stop` in interface `MembershipProvider`
Throws:
  `Exception`

#### startMembership

    protected void startMembership​(Member[] members)
                            throws ChannelException

Throws:
  `ChannelException`

#### setupMember

    protected Member setupMember​(Member mbr)

#### memberAdded

    protected void memberAdded​(Member member)

#### memberDisappeared

    protected void memberDisappeared​(Member member)

#### memberAlive

    protected void memberAlive​(Member member)

#### stopMembership

    protected void stopMembership​(Member[] members)

#### messageReceived

    public void messageReceived​(Serializable msg,
                                Member sender)

Description copied from interface: `ChannelListener`
Receive a message from the channel

Specified by:
  `messageReceived` in interface `ChannelListener`
Parameters:
  `msg` - Serializable
  `sender` - - the source of the message

#### accept

    public boolean accept​(Serializable msg,
                          Member sender)

Description copied from interface: `ChannelListener`
Invoked by the channel to determine if the listener will process this message or not.

Specified by:
  `accept` in interface `ChannelListener`
Parameters:
  `msg` - Serializable
  `sender` - Member
Returns:
  boolean

#### replyRequest

    public Serializable replyRequest​(Serializable msg,
                                     Member sender)

Description copied from interface: `RpcCallback`
Allows sending a response to a received message.

Specified by:
  `replyRequest` in interface `RpcCallback`
Parameters:
  `msg` - The message
  `sender` - Member
Returns:
  Serializable object, `null` if no reply should be sent

#### leftOver

    public void leftOver​(Serializable msg,
                         Member sender)

Description copied from interface: `RpcCallback`
If the reply has already been sent to the requesting thread, the rpc callback can handle any data that comes in after the fact.

Specified by:
  `leftOver` in interface `RpcCallback`
Parameters:
  `msg` - The message
  `sender` - Member

#### heartbeat

    public void heartbeat()

Description copied from interface: `Heartbeat`
Heartbeat invocation for resources cleanup etc

Specified by:
  `heartbeat` in interface `Heartbeat`

#### ping

    protected void ping()
                 throws ChannelException

Throws:
  `ChannelException`

#### checkExpired

    protected void checkExpired()

#### setChannel

    public void setChannel​(Channel channel)

#### setStaticMembers

    public void setStaticMembers​(ArrayList<StaticMember> staticMembers)