org.apache.activemq.artemis.api.core

## Class JGroupsBroadcastEndpoint

- java.lang.Object
- - org.apache.activemq.artemis.api.core.JGroupsBroadcastEndpoint

- All Implemented Interfaces:
    BroadcastEndpoint
  Direct Known Subclasses:
    JGroupsChannelBroadcastEndpoint, JGroupsFileBroadcastEndpoint, JGroupsPropertiesBroadcastEndpoint

      public abstract class JGroupsBroadcastEndpoint
      extends Object
      implements BroadcastEndpoint

  This class is the implementation of ActiveMQ Artemis members discovery that will use JGroups.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `JGroupsBroadcastEndpoint(JChannelManager manager, String channelName)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `broadcast(byte[] data)` Broadcasting data to the cluster.
    `void` | `close(boolean isBroadcast)` Close the endpoint.
    `abstract org.jgroups.JChannel` | `createChannel()`
    `JGroupsBroadcastEndpoint` | `initChannel()`
    `protected void` | `internalCloseChannel(JChannelWrapper channel)` Closes the channel used in this JGroups Broadcast.
    `protected void` | `internalOpen()`
    `void` | `openBroadcaster()` This method initializes a BroadcastEndpint as a broadcaster.
    `void` | `openClient()` This method initializes a BroadcastEndpoint as a receiving end for broadcasts.
    `byte[]` | `receiveBroadcast()` Receives the broadcast data.
    `byte[]` | `receiveBroadcast(long time, TimeUnit unit)` Receives the broadcast data with a timeout.

    - ### Methods inherited from class java.lang.Object

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

- - ### Constructor Detail

    - #### JGroupsBroadcastEndpoint

          public JGroupsBroadcastEndpoint(JChannelManager manager,
                                          String channelName)

  - ### Method Detail

    - #### broadcast

          public void broadcast(byte[] data)
                         throws Exception

      Description copied from interface: `BroadcastEndpoint`
      Broadcasting data to the cluster.
      Specified by:
        `broadcast` in interface `BroadcastEndpoint`
      Parameters:
        `data` - : a byte array containing the data.
      Throws:
        `Exception`

    - #### receiveBroadcast

          public byte[] receiveBroadcast()
                                  throws Exception

      Description copied from interface: `BroadcastEndpoint`
      Receives the broadcast data. It blocks until data is available.
      Specified by:
        `receiveBroadcast` in interface `BroadcastEndpoint`
      Returns:
        the received data as byte array.
      Throws:
        `Exception`

    - #### receiveBroadcast

          public byte[] receiveBroadcast(long time,
                                         TimeUnit unit)
                                  throws Exception

      Description copied from interface: `BroadcastEndpoint`
      Receives the broadcast data with a timeout. It blocks until either the data is available or the timeout is reached, whichever comes first.
      Specified by:
        `receiveBroadcast` in interface `BroadcastEndpoint`
      Parameters:
        `time` - : how long the method should wait for the data to arrive.
        `unit` - : unit of the time.
      Returns:
        a byte array if data is arrived within the timeout, or null if no data is available after the timeout.
      Throws:
        `Exception`

    - #### openClient

          public void openClient()
                          throws Exception

      Description copied from interface: `BroadcastEndpoint`
      This method initializes a BroadcastEndpoint as a receiving end for broadcasts. After that data can be received using one of its receiveBroadcast() methods.
      Specified by:
        `openClient` in interface `BroadcastEndpoint`
      Throws:
        `Exception`

    - #### openBroadcaster

          public void openBroadcaster()
                               throws Exception

      Description copied from interface: `BroadcastEndpoint`
      This method initializes a BroadcastEndpint as a broadcaster. After that data can be sent via its broadcast() method.
      Specified by:
        `openBroadcaster` in interface `BroadcastEndpoint`
      Throws:
        `Exception`

    - #### createChannel

          public abstract org.jgroups.JChannel createChannel()
                                                      throws Exception

      Throws:
        `Exception`

    - #### initChannel

          public JGroupsBroadcastEndpoint initChannel()
                                               throws Exception

      Throws:
        `Exception`

    - #### internalOpen

          protected void internalOpen()
                               throws Exception

      Throws:
        `Exception`

    - #### close

          public void close(boolean isBroadcast)
                     throws Exception

      Description copied from interface: `BroadcastEndpoint`
      Close the endpoint. Any related resources should be cleaned up in this method.
      Specified by:
        `close` in interface `BroadcastEndpoint`
      Parameters:
        `isBroadcast` - : indicates whether this endpoint serves as a broadcast or not.
      Throws:
        `Exception`

    - #### internalCloseChannel

          protected void internalCloseChannel(JChannelWrapper channel)

      Closes the channel used in this JGroups Broadcast. Can be overridden by implementations that use an externally managed channel.
      Parameters:
        `channel` -

Copyright © 2021 The Apache Software Foundation. All rights reserved.