## org.apache.catalina.tribes
Interface MembershipService

All Known Implementing Classes:
  McastService

    public interface MembershipService

MembershipService Interface
The `MembershipService` interface is the membership component at the bottom layer, the IO layer (for layers see the javadoc for the `Channel` interface).

Version:
  $Revision: 467222 $, $Date: 2006-10-24 05:17:11 +0200 (Tue, 24 Oct 2006) $
Author:
  Filip Hanik

Field Summary
`static int` `MBR_RX`
`static int` `MBR_TX`

Method Summary
`Member` `findMemberByName(java.lang.String name)` Return the member by name
`Member` `getLocalMember(boolean incAliveTime)` Returns the member object that defines this member
`Member` `getMember(Member mbr)`
`Member[]` `getMembers()` Returns a list of all the members in the cluster.
`java.lang.String[]` `getMembersByName()` Return all members by name
`java.util.Properties` `getProperties()` Returns the properties for the configuration used.
`boolean` `hasMembers()`
`void` `removeMembershipListener()` removes the membership listener.
`void` `setDomain(byte[] domain)`
`void` `setLocalMemberProperties(java.lang.String listenHost, int listenPort)` Sets the local member properties for broadcasting
`void` `setMembershipListener(MembershipListener listener)` Sets the membership listener, only one listener can be added.
`void` `setPayload(byte[] payload)` Set a payload to be broadcasted with each membership broadcast.
`void` `setProperties(java.util.Properties properties)` Sets the properties for the membership service.
`void` `start()` Starts the membership service.
`void` `start(int level)` Starts the membership service.
`void` `stop(int level)` Starts the membership service.

Field Detail

### MBR_RX

    static final int MBR_RX

See Also:
  Constant Field Values

### MBR_TX

    static final int MBR_TX

See Also:
  Constant Field Values

Method Detail

### setProperties

    void setProperties(java.util.Properties properties)

  Sets the properties for the membership service. This must be called before the `start()` method is called. The properties are implementation specific.

  Parameters:
    `properties` - - to be used to configure the membership service.

### getProperties

    java.util.Properties getProperties()

  Returns the properties for the configuration used.

### start

    void start()
               throws java.lang.Exception

  Starts the membership service. If a membership listeners is added the listener will start to receive membership events. Performs a start level 1 and 2

  Throws:
    `java.lang.Exception` - if the service fails to start.

### start

    void start(int level)
               throws java.lang.Exception

  Starts the membership service. If a membership listeners is added the listener will start to receive membership events.

  Parameters:
    `level` - - level MBR_RX starts listening for members, level MBR_TX starts broad casting the server
  Throws:
    `java.lang.Exception` - if the service fails to start.
    `java.lang.IllegalArgumentException` - if the level is incorrect.

### stop

    void stop(int level)

  Starts the membership service. If a membership listeners is added the listener will start to receive membership events.

  Parameters:
    `level` - - level MBR_RX stops listening for members, level MBR_TX stops broad casting the server
  Throws:
    `java.lang.Exception` - if the service fails to stop
    `java.lang.IllegalArgumentException` - if the level is incorrect.

### hasMembers

    boolean hasMembers()

  Returns:
    true if the the group contains members

### getMember

    Member getMember(Member mbr)

  Parameters:
    `mbr` - Member
  Returns:
    Member

### getMembers

    Member[] getMembers()

  Returns a list of all the members in the cluster.

### getLocalMember

    Member getLocalMember(boolean incAliveTime)

  Returns the member object that defines this member

### getMembersByName

    java.lang.String[] getMembersByName()

  Return all members by name

### findMemberByName

    Member findMemberByName(java.lang.String name)

  Return the member by name

### setLocalMemberProperties

    void setLocalMemberProperties(java.lang.String listenHost,
                                  int listenPort)

  Sets the local member properties for broadcasting

### setMembershipListener

    void setMembershipListener(MembershipListener listener)

  Sets the membership listener, only one listener can be added. If you call this method twice, the last listener will be used.

  Parameters:
    `listener` - The listener

### removeMembershipListener

    void removeMembershipListener()

  removes the membership listener.

### setPayload

    void setPayload(byte[] payload)

  Set a payload to be broadcasted with each membership broadcast.

  Parameters:
    `payload` - byte[]

### setDomain

    void setDomain(byte[] domain)

Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.