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

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

All Implemented Interfaces:
  Member, java.io.Serializable

public class McastMember
extends java.lang.Object
implements Member, java.io.Serializable

A membership implementation using simple multicast. This is the representation of a multicast member. Carries the host, and port of the this or other cluster nodes.

Version:
  $Id: McastMember.java 939539 2010-04-30 01:31:33Z kkolinko $
Author:
  Filip Hanik, Peter Rossbach
See Also:
  Serialized Form

Field Summary
`protected java.lang.String` `host` The listen host for this member
`static java.lang.String` `MEMBER_DOMAIN`
`static java.lang.String` `MEMBER_NAME`
`protected long` `memberAliveTime` The number of milliseconds since this members was created, is kept track of using the start time
`protected int` `msgCount` Counter for how many messages have been sent from this member
`protected int` `port` The tcp listen port for this member
`static java.lang.String` `TCP_LISTEN_HOST`
`static java.lang.String` `TCP_LISTEN_PORT` Public properties specific to this implementation

Constructor Summary
`McastMember(java.lang.String name, java.lang.String domain, java.lang.String host, int port, long aliveTime)` Construct a new member object

Method Summary
`boolean` `equals(java.lang.Object o)` Returns true if the param o is a McastMember with the same name
`protected byte[]` `getData(long startTime)` Create a data package to send over the wire representing this member.
`java.lang.String` `getDomain()` Return the domain of this object
`java.lang.String` `getHost()` Return the TCP listen host for this member
`protected static McastMember` `getMember(byte[] data)` Deserializes a member from data sent over the wire
`long` `getMemberAliveTime()` Contains information on how long this member has been online.
`java.util.HashMap` `getMemberProperties()` Return implementation specific properties about this cluster node.
`java.lang.String` `getName()` Return the name of this object
`int` `getPort()` Return the listen port of this member
`int` `hashCode()`
`protected void` `inc()` Increment the message count.
`void` `setDomain(java.lang.String domain)`
`void` `setHost(java.lang.String host)`
`void` `setMemberAliveTime(long time)`
`void` `setMsgCount(int msgCount)`
`void` `setName(java.lang.String name)`
`void` `setPort(int port)`
`java.lang.String` `toString()` String representation of this object

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

Field Detail

### TCP_LISTEN_PORT

    public static final transient java.lang.String TCP_LISTEN_PORT

  Public properties specific to this implementation

  See Also:
    Constant Field Values

### TCP_LISTEN_HOST

    public static final transient java.lang.String TCP_LISTEN_HOST

See Also:
  Constant Field Values

### MEMBER_NAME

    public static final transient java.lang.String MEMBER_NAME

See Also:
  Constant Field Values

### MEMBER_DOMAIN

    public static final transient java.lang.String MEMBER_DOMAIN

See Also:
  Constant Field Values

### host

    protected java.lang.String host

  The listen host for this member

### port

    protected int port

  The tcp listen port for this member

### msgCount

    protected int msgCount

  Counter for how many messages have been sent from this member

### memberAliveTime

    protected long memberAliveTime

  The number of milliseconds since this members was created, is kept track of using the start time

Constructor Detail

### McastMember

    public McastMember(java.lang.String name,
                       java.lang.String domain,
                       java.lang.String host,
                       int port,
                       long aliveTime)

  Construct a new member object

Parameters:
  `name` - - the name of this member, cluster unique
  `domain` - - the cluster domain name of this member
  `host` - - the tcp listen host
  `port` - - the tcp listen port

Method Detail

### getMemberProperties

    public java.util.HashMap getMemberProperties()

  Description copied from interface: `Member`
  Return implementation specific properties about this cluster node.

  Specified by:
    `getMemberProperties` in interface `Member`
  Returns:
    a Hashmap containing the following properties:
    1. tcpListenPort - the port this member listens to for messages - string
    2. tcpListenHost - the host address of this member - string
    3. memberName - the name of this member - string

### inc

    protected void inc()

  Increment the message count.

### getData

    protected byte[] getData(long startTime)
                      throws java.lang.Exception

  Create a data package to send over the wire representing this member. This is faster than serialization.

  Returns:
    - the bytes for this member deserialized
  Throws:
    `java.lang.Exception`

### getMember

    protected static McastMember getMember(byte[] data)

  Deserializes a member from data sent over the wire

  Parameters:
    `data` - - the bytes received
  Returns:
    a member object.

### getName

    public java.lang.String getName()

  Return the name of this object

  Specified by:
    `getName` in interface `Member`
  Returns:
    a unique name to the cluster

### getDomain

    public java.lang.String getDomain()

  Return the domain of this object

  Specified by:
    `getDomain` in interface `Member`
  Returns:
    a cluster domain to the cluster

### getPort

    public int getPort()

  Return the listen port of this member

  Specified by:
    `getPort` in interface `Member`
  Returns:
    - tcp listen port

### getHost

    public java.lang.String getHost()

  Return the TCP listen host for this member

  Specified by:
    `getHost` in interface `Member`
  Returns:
    IP address or host name

### getMemberAliveTime

    public long getMemberAliveTime()

  Contains information on how long this member has been online. The result is the number of milli seconds this member has been broadcasting its membership to the cluster.

  Specified by:
    `getMemberAliveTime` in interface `Member`
  Returns:
    nr of milliseconds since this member started.

### setMemberAliveTime

    public void setMemberAliveTime(long time)

### toString

    public java.lang.String toString()

  String representation of this object

### hashCode

    public int hashCode()

  Returns:
    The hash code
  See Also:
    `Object.hashCode()`

### equals

    public boolean equals(java.lang.Object o)

  Returns true if the param o is a McastMember with the same name

  Parameters:
    `o` -

### setHost

    public void setHost(java.lang.String host)

### setMsgCount

    public void setMsgCount(int msgCount)

### setName

    public void setName(java.lang.String name)

### setDomain

    public void setDomain(java.lang.String domain)

### setPort

    public void setPort(int port)

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