# Class NonBlockingCoordinator.CoordinationMessage

java.lang.Object
org.apache.catalina.tribes.group.interceptors.NonBlockingCoordinator.CoordinationMessage

Enclosing class:
  `NonBlockingCoordinator`

public static class NonBlockingCoordinator.CoordinationMessage extends Object
Represents a coordination message used in the election protocol.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected final XByteBuffer`
  `buf`
  The byte buffer for the message.
  `protected UniqueId`
  `id`
  The message ID.
  `protected Member`
  `leader`
  The leader member.
  `protected Member`
  `source`
  The source member.
  `protected byte[]`
  `type`
  The message type.
  `protected Member[]`
  `view`
  The member view.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CoordinationMessage(XByteBuffer buf)`
  Constructs a CoordinationMessage from a buffer.
  `CoordinationMessage(Member leader, Member source, Member[] view, UniqueId id, byte[] type)`
  Constructs a CoordinationMessage with the given parameters.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `XByteBuffer`
  `getBuffer()`
  Returns the message buffer.
  `byte[]`
  `getHeader()`
  Returns the coordination message header.
  `UniqueId`
  `getId()`
  Returns the message ID.
  `Member`
  `getLeader()`
  Returns the leader member.
  `Member[]`
  `getMembers()`
  Returns the member view.
  `Member`
  `getSource()`
  Returns the source member.
  `byte[]`
  `getType()`
  Returns the message type.
  `void`
  `parse()`
  Parses the message from the buffer.
  `void`
  `write()`
  Writes the message to the buffer.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### buf

    protected final XByteBuffer buf
    The byte buffer for the message.

  - ### leader

    protected Member leader
    The leader member.

  - ### source

    protected Member source
    The source member.

  - ### view

    protected Member[] view
    The member view.

  - ### id

    protected UniqueId id
    The message ID.

  - ### type

    protected byte[] type
    The message type.

- ## Constructor Details

  - ### CoordinationMessage

    public CoordinationMessage(XByteBuffer buf)
    Constructs a CoordinationMessage from a buffer.
    Parameters:
      `buf` - The byte buffer containing the message

  - ### CoordinationMessage

    public CoordinationMessage(Member leader, Member source, Member[] view, UniqueId id, byte[] type)
    Constructs a CoordinationMessage with the given parameters.
    Parameters:
      `leader` - The leader member
      `source` - The source member
      `view` - The member view
      `id` - The message ID
      `type` - The message type

- ## Method Details

  - ### getHeader

    public byte[] getHeader()
    Returns the coordination message header.
    Returns:
      The header bytes

  - ### getLeader

    public Member getLeader()
    Returns the leader member.
    Returns:
      The leader member

  - ### getSource

    public Member getSource()
    Returns the source member.
    Returns:
      The source member

  - ### getId

    public UniqueId getId()
    Returns the message ID.
    Returns:
      The message ID

  - ### getMembers

    public Member[] getMembers()
    Returns the member view.
    Returns:
      The array of members

  - ### getType

    public byte[] getType()
    Returns the message type.
    Returns:
      The type bytes

  - ### getBuffer

    public XByteBuffer getBuffer()
    Returns the message buffer.
    Returns:
      The byte buffer

  - ### parse

    public void parse()
    Parses the message from the buffer.

  - ### write

    public void write()
    Writes the message to the buffer.