Member (Apache Tomcat 9.0.111 API Documentation)
Description: declaration: package: org.apache.catalina.tribes, interface: Member

# Interface Member

All Superinterfaces:
  `Serializable`

All Known Implementing Classes:
  `MemberImpl, StaticMember`

public interface Member extends Serializable
The Member interface, defines a member in the group. Each member can carry a set of properties, defined by the actual implementation.

A member is identified by the host/ip/uniqueId.

- The host is what interface the member is listening to, to receive data
- The port is what port the member is listening to, to receive data
- The uniqueId defines the session id for the member. This is an important feature since a member that has crashed and the starts up again on the same port/host is not guaranteed to be the same member, so no state transfers will ever be confused.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final byte[]`
  `SHUTDOWN_PAYLOAD`
  When a member leaves the cluster, the payload of the memberDisappeared member will be the following bytes.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `byte[]`
  `getCommand()`
  `byte[]`
  `getData(boolean getalive)`
  Highly optimized version of serializing a member into a byte array Returns a cached byte[] reference, do not modify this data
  `byte[]`
  `getData(boolean getalive, boolean reset)`
  Highly optimized version of serializing a member into a byte array Returns a cached byte[] reference, do not modify this data
  `int`
  `getDataLength()`
  Length of a message obtained by `getData(boolean)` or `getData(boolean, boolean)`.
  `byte[]`
  `getDomain()`
  `byte[]`
  `getHost()`
  Returns the listen host for the ChannelReceiver implementation
  `long`
  `getMemberAliveTime()`
  Contains information on how long this member has been online.
  `String`
  `getName()`
  `byte[]`
  `getPayload()`
  `int`
  `getPort()`
  Returns the listen port for the ChannelReceiver implementation
  `int`
  `getSecurePort()`
  Returns the secure listen port for the ChannelReceiver implementation.
  `int`
  `getUdpPort()`
  Returns the UDP port that this member is listening to for UDP messages.
  `byte[]`
  `getUniqueId()`
  returns a UUID unique for this member over all sessions.
  `boolean`
  `isFailing()`
  `boolean`
  `isLocal()`
  `boolean`
  `isReady()`
  The current state of the member.
  `boolean`
  `isSuspect()`
  The current state of the member.
  `void`
  `setCommand(byte[] command)`
  Set the command associated with this member.
  `void`
  `setLocal(boolean local)`
  Set if the member is local.
  `void`
  `setMemberAliveTime(long memberAliveTime)`
  Set the alive time in ms.
  `void`
  `setPayload(byte[] payload)`
  Set the payload associated with this member.

- ## Field Details

  - ### SHUTDOWN_PAYLOAD

    static final byte[] SHUTDOWN_PAYLOAD
    When a member leaves the cluster, the payload of the memberDisappeared member will be the following bytes. This indicates a soft shutdown, and not a crash

- ## Method Details

  - ### getName

    String getName()
    Returns:
      the name of this node, should be unique within the group.

  - ### getHost

    byte[] getHost()
    Returns the listen host for the ChannelReceiver implementation
    Returns:
      IPv4 or IPv6 representation of the host address this member listens to incoming data
    See Also:
      - `ChannelReceiver`

  - ### getPort

    int getPort()
    Returns the listen port for the ChannelReceiver implementation
    Returns:
      the listen port for this member, -1 if it's not listening on an insecure port
    See Also:
      - `ChannelReceiver`

  - ### getSecurePort

    int getSecurePort()
    Returns the secure listen port for the ChannelReceiver implementation. Returns -1 if it's not listening to a secure port.
    Returns:
      the listen port for this member, -1 if it's not listening on a secure port
    See Also:
      - `ChannelReceiver`

  - ### getUdpPort

    int getUdpPort()
    Returns the UDP port that this member is listening to for UDP messages.
    Returns:
      the listen UDP port for this member, -1 if it's not listening on a UDP port

  - ### getMemberAliveTime

    long getMemberAliveTime()
    Contains information on how long this member has been online. The result is the number of milliseconds this member has been broadcasting its membership to the group.
    Returns:
      nr of milliseconds since this member started.

  - ### setMemberAliveTime

    void setMemberAliveTime(long memberAliveTime)
    Set the alive time in ms.
    Parameters:
      `memberAliveTime` - the value to set

  - ### isReady

    boolean isReady()
    The current state of the member.
    Returns:
      `true` if the member is functioning correctly

  - ### isSuspect

    boolean isSuspect()
    The current state of the member.
    Returns:
      `true` if the member is suspect, but the crash has not been confirmed

  - ### isFailing

    boolean isFailing()
    Returns:
      `true` if the member has been confirmed to malfunction

  - ### getUniqueId

    byte[] getUniqueId()
    returns a UUID unique for this member over all sessions. If the member crashes and restarts, the uniqueId will be different.
    Returns:
      byte[]

  - ### getPayload

    byte[] getPayload()
    Returns:
      the payload associated with this member

  - ### setPayload

    void setPayload(byte[] payload)
    Set the payload associated with this member.
    Parameters:
      `payload` - the payload

  - ### getCommand

    byte[] getCommand()
    Returns:
      the command associated with this member

  - ### setCommand

    void setCommand(byte[] command)
    Set the command associated with this member.
    Parameters:
      `command` - the command

  - ### getDomain

    byte[] getDomain()
    Returns:
      the domain for this cluster

  - ### getData

    byte[] getData(boolean getalive)
    Highly optimized version of serializing a member into a byte array Returns a cached byte[] reference, do not modify this data
    Parameters:
      `getalive` - calculate memberAlive time
    Returns:
      the data as a byte array

  - ### getData

    byte[] getData(boolean getalive, boolean reset)
    Highly optimized version of serializing a member into a byte array Returns a cached byte[] reference, do not modify this data
    Parameters:
      `getalive` - calculate memberAlive time
      `reset` - reset the cached data package, and create a new one
    Returns:
      the data as a byte array

  - ### getDataLength

    int getDataLength()
    Length of a message obtained by `getData(boolean)` or `getData(boolean, boolean)`.
    Returns:
      the data length

  - ### isLocal

    boolean isLocal()
    Returns:
      `true` if the member is local member

  - ### setLocal

    void setLocal(boolean local)
    Set if the member is local.
    Parameters:
      `local` - set to `true` if this is the local member