## org.apache.catalina.cluster
Interface MembershipService

All Known Implementing Classes:
  McastService

public interface MembershipService

The membership service helps the cluster determine the membership logic in the cluster.

Version:
  $Id: MembershipService.java 939539 2010-04-30 01:31:33Z kkolinko $
Author:
  Peter Rossbach, Filip Hanik

Method Summary
`void` `addMembershipListener(MembershipListener listener)` Sets the membership listener, only one listener can be added.
`Member` `findMemberByName(java.lang.String name)` Return the member by name
`Member` `getLocalMember()` Returns the member object that defines this member
`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()` Returns that cluster has members.
`void` `removeMembershipListener()` removes the membership listener.
`void` `setCatalinaCluster(SimpleTcpCluster cluster)`
`void` `setLocalMemberProperties(java.lang.String listenHost, int listenPort)` Sets the local member properties for broadcasting
`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()` Stops the membership service

Method Detail

### setProperties

    public 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

    public java.util.Properties getProperties()

  Returns the properties for the configuration used.

### start

    public 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

    public 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 1 starts listening for members, level 2 starts broad casting the server
  Throws:
    `java.lang.Exception` - if the service fails to start.

### stop

    public void stop()

  Stops the membership service

### hasMembers

    public boolean hasMembers()

  Returns that cluster has members.

### getMembers

    public Member[] getMembers()

  Returns a list of all the members in the cluster.

### getLocalMember

    public Member getLocalMember()

  Returns the member object that defines this member

### getMembersByName

    public java.lang.String[] getMembersByName()

  Return all members by name

### findMemberByName

    public Member findMemberByName(java.lang.String name)

  Return the member by name

### setLocalMemberProperties

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

  Sets the local member properties for broadcasting

### addMembershipListener

    public void addMembershipListener(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

    public void removeMembershipListener()

  removes the membership listener.

### setCatalinaCluster

    public void setCatalinaCluster(SimpleTcpCluster cluster)

  Parameters:
    `cluster` -

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