Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.catalina.cluster.mcast
Class McastService

    java.lang.Object
      org.apache.catalina.cluster.mcast.McastService

All Implemented Interfaces:
  MembershipListener, MembershipService

public class McastService
extends java.lang.Object
implements MembershipService, MembershipListener

A membership implementation using simple multicast. This is the representation of a multicast membership service. This class is responsible for maintaining a list of active cluster nodes in the cluster. If a node fails to send out a heartbeat, the node will be dismissed. FIXME i18n messages

Version:
  $Revision: 567470 $, $Date: 2007-08-19 15:04:15 -0600 (Sun, 19 Aug 2007) $
Author:
  Peter Rossbach, Filip Hanik

Field Summary
`protected McastServiceImpl` | `impl` A handle to the actual low level implementation
`protected MembershipListener` | `listener` A membership listener delegate (should be the cluster :)
`protected McastMember` | `localMember` The local member
`protected java.util.Properties` | `properties` The implementation specific properties
`protected StringManager` | `sm` The string manager for this package.

Constructor Summary
`McastService()` Create a membership service.

Method Summary
`void` | `addMembershipListener(MembershipListener listener)` Add a membership listener, this version only supports one listener per service, so calling this method twice will result in only the second listener being active.
`Member` | `findMemberByName(java.lang.String name)` Return the member by name
`Cluster` | `getCatalinaCluster()` Return the cluster for this membership service
`java.lang.String` | `getInfo()` Return descriptive information about this implementation and the corresponding version number, in the format `<description>/<version>`.
`Member` | `getLocalMember()` Return the local member
`java.lang.String` | `getLocalMemberName()` Return the local member name
`java.lang.String` | `getMcastAddr()`
`java.lang.String` | `getMcastBindAddress()`
`java.lang.String` | `getMcastClusterDomain()`
`long` | `getMcastDropTime()`
`long` | `getMcastFrequency()`
`int` | `getMcastPort()`
`int` | `getMcastSoTimeout()`
`int` | `getMcastTTL()`
`Member[]` | `getMembers()` Return all the members
`java.lang.String[]` | `getMembersByName()` Return all the members by name
`javax.management.ObjectName` | `getObjectName()`
`java.util.Properties` | `getProperties()` Return the properties, see setProperties
`int` | `getRecoveryCounter()`
`long` | `getRecoverySleepTime()`
`boolean` | `hasMembers()` has members?
`protected void` | `hasProperty(java.util.Properties properties, java.lang.String name)` Check if a required property is available.
`protected void` | `initMBeans()` register mbean descriptor for package mcast
`boolean` | `isRecoveryEnabled()`
`static void` | `main(java.lang.String[] args)` Simple test program
`void` | `memberAdded(Member member)`
`void` | `memberDisappeared(Member member)` Callback from the impl when a new member has been received
`protected void` | `registerMBean()` register MBeans for Membership
`void` | `removeMembershipListener()` Remove the membership listener
`void` | `setCatalinaCluster(SimpleTcpCluster cluster)`
`void` | `setLocalMemberProperties(java.lang.String listenHost, int listenPort)` Sets the local member properties for broadcasting
`void` | `setMcastAddr(java.lang.String addr)`
`void` | `setMcastBindAddress(java.lang.String bindaddr)`
`void` | `setMcastClusterDomain(java.lang.String clusterDomain)`
`void` | `setMcastDropTime(long time)`
`void` | `setMcastFrequency(long time)`
`void` | `setMcastPort(int port)`
`void` | `setMcastSoTimeout(int mcastSoTimeout)`
`void` | `setMcastTTL(int mcastTTL)`
`void` | `setObjectName(javax.management.ObjectName name)` Transmitter ObjectName
`void` | `setProperties(java.util.Properties properties)` Sets the properties for the membership service.
`void` | `setRecoveryCounter(int recoveryCounter)`
`void` | `setRecoveryEnabled(boolean recoveryEnabled)`
`void` | `setRecoverySleepTime(long recoverySleepTime)`
`void` | `start()` Start broadcasting and listening to membership pings
`void` | `start(int level)` Starts the membership service.
`void` | `stop()` Stop broadcasting and listening to membership pings
`protected void` | `unregisterMBean()` unregister MBeans for Membership

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### sm

    protected StringManager sm

  The string manager for this package.

### properties

    protected java.util.Properties properties

  The implementation specific properties

### impl

    protected McastServiceImpl impl

  A handle to the actual low level implementation

### listener

    protected MembershipListener listener

  A membership listener delegate (should be the cluster :)

### localMember

    protected McastMember localMember

  The local member

Constructor Detail

### McastService

    public McastService()

  Create a membership service.

Method Detail

### getInfo

    public java.lang.String getInfo()

  Return descriptive information about this implementation and the corresponding version number, in the format `<description>/<version>`.

### setObjectName

    public void setObjectName(javax.management.ObjectName name)

  Transmitter ObjectName

  Parameters:
    `name` -

### getObjectName

    public javax.management.ObjectName getObjectName()

### setProperties

    public void setProperties(java.util.Properties properties)

  Description copied from interface: `MembershipService`
  Sets the properties for the membership service. This must be called before the `start()` method is called. The properties are implementation specific.

  Specified by:
    `setProperties` in interface `MembershipService`
  Parameters:
    `properties` -
    All are required
    1. mcastPort - the port to listen to
    2. mcastAddress - the mcast group address
    3. mcastClusterDomain - the mcast cluster domain
    4. bindAddress - the bind address if any - only one that can be null
    5. memberDropTime - the time a member is gone before it is considered gone.
    6. msgFrequency - the frequency of sending messages
    7. tcpListenPort - the port this member listens to
    8. tcpListenHost - the bind address of this member
  Throws:
    `java.lang.IllegalArgumentException` - if a property is missing.

### getProperties

    public java.util.Properties getProperties()

  Return the properties, see setProperties

  Specified by:
    `getProperties` in interface `MembershipService`

### setCatalinaCluster

    public void setCatalinaCluster(SimpleTcpCluster cluster)

  Specified by:
    `setCatalinaCluster` in interface `MembershipService`
  Parameters:
    `cluster` -

### getCatalinaCluster

    public Cluster getCatalinaCluster()

  Return the cluster for this membership service

### getLocalMemberName

    public java.lang.String getLocalMemberName()

  Return the local member name

### getLocalMember

    public Member getLocalMember()

  Return the local member

  Specified by:
    `getLocalMember` in interface `MembershipService`

### setLocalMemberProperties

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

  Sets the local member properties for broadcasting

  Specified by:
    `setLocalMemberProperties` in interface `MembershipService`

### setMcastAddr

    public void setMcastAddr(java.lang.String addr)

### getMcastAddr

    public java.lang.String getMcastAddr()

### setMcastBindAddress

    public void setMcastBindAddress(java.lang.String bindaddr)

### getMcastBindAddress

    public java.lang.String getMcastBindAddress()

### setMcastClusterDomain

    public void setMcastClusterDomain(java.lang.String clusterDomain)

### getMcastClusterDomain

    public java.lang.String getMcastClusterDomain()

### setMcastPort

    public void setMcastPort(int port)

### getMcastPort

    public int getMcastPort()

### setMcastFrequency

    public void setMcastFrequency(long time)

### getMcastFrequency

    public long getMcastFrequency()

### setMcastDropTime

    public void setMcastDropTime(long time)

### getMcastDropTime

    public long getMcastDropTime()

### hasProperty

    protected void hasProperty(java.util.Properties properties,
                               java.lang.String name)

  Check if a required property is available.

  Parameters:
    `properties` - The set of properties
    `name` - The property to check for

### start

    public void start()
               throws java.lang.Exception

  Start broadcasting and listening to membership pings

  Specified by:
    `start` in interface `MembershipService`
  Throws:
    `java.lang.Exception` - if a IO error occurs

### start

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

  Description copied from interface: `MembershipService`
  Starts the membership service. If a membership listeners is added the listener will start to receive membership events.

  Specified by:
    `start` in interface `MembershipService`
  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()

  Stop broadcasting and listening to membership pings

  Specified by:
    `stop` in interface `MembershipService`

### initMBeans

    protected void initMBeans()
                       throws java.lang.Exception

  register mbean descriptor for package mcast

  Throws:
    `java.lang.Exception`

### registerMBean

    protected void registerMBean()

  register MBeans for Membership

### unregisterMBean

    protected void unregisterMBean()

  unregister MBeans for Membership

### getMembersByName

    public java.lang.String[] getMembersByName()

  Return all the members by name

  Specified by:
    `getMembersByName` in interface `MembershipService`

### findMemberByName

    public Member findMemberByName(java.lang.String name)

  Return the member by name

  Specified by:
    `findMemberByName` in interface `MembershipService`

### hasMembers

    public boolean hasMembers()

  has members?

  Specified by:
    `hasMembers` in interface `MembershipService`

### getMembers

    public Member[] getMembers()

  Return all the members

  Specified by:
    `getMembers` in interface `MembershipService`

### addMembershipListener

    public void addMembershipListener(MembershipListener listener)

  Add a membership listener, this version only supports one listener per service, so calling this method twice will result in only the second listener being active.

  Specified by:
    `addMembershipListener` in interface `MembershipService`
  Parameters:
    `listener` - The listener

### removeMembershipListener

    public void removeMembershipListener()

  Remove the membership listener

  Specified by:
    `removeMembershipListener` in interface `MembershipService`

### memberAdded

    public void memberAdded(Member member)

  Specified by:
    `memberAdded` in interface `MembershipListener`

### memberDisappeared

    public void memberDisappeared(Member member)

  Callback from the impl when a new member has been received

  Specified by:
    `memberDisappeared` in interface `MembershipListener`
  Parameters:
    `member` - The member

### getMcastSoTimeout

    public int getMcastSoTimeout()

### setMcastSoTimeout

    public void setMcastSoTimeout(int mcastSoTimeout)

### getMcastTTL

    public int getMcastTTL()

### setMcastTTL

    public void setMcastTTL(int mcastTTL)

### getRecoveryCounter

    public int getRecoveryCounter()

### isRecoveryEnabled

    public boolean isRecoveryEnabled()

### getRecoverySleepTime

    public long getRecoverySleepTime()

### setRecoveryCounter

    public void setRecoveryCounter(int recoveryCounter)

### setRecoveryEnabled

    public void setRecoveryEnabled(boolean recoveryEnabled)

### setRecoverySleepTime

    public void setRecoverySleepTime(long recoverySleepTime)

### main

    public static void main(java.lang.String[] args)
                     throws java.lang.Exception

  Simple test program

  Parameters:
    `args` - Command-line arguments
  Throws:
    `java.lang.Exception` - If an error occurs

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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