Class LocalSocketAddressStatus

java.lang.Object
io.aeron.status.LocalSocketAddressStatus

public class LocalSocketAddressStatus extends Object
Counter used to store the status of a bind address and port for the local end of a channel.

When the value is ChannelEndpointStatus.ACTIVE then the key value and label will be updated with the socket address and port which is bound.

  • Field Details

    • INITIAL_LENGTH

      public static final int INITIAL_LENGTH
      Initial length for a key, this will be expanded later when bound.
      See Also:
    • LOCAL_SOCKET_ADDRESS_STATUS_TYPE_ID

      public static final int LOCAL_SOCKET_ADDRESS_STATUS_TYPE_ID
      Type of the counter used to track a local socket address and port.
      See Also:
  • Constructor Details

    • LocalSocketAddressStatus

      public LocalSocketAddressStatus()
  • Method Details

    • allocate

      public static AtomicCounter allocate(MutableDirectBuffer tempBuffer, CountersManager countersManager, long registrationId, int channelStatusId, String name, int typeId)
      Allocate a counter to represent a local socket address associated with a channel.
      Parameters:
      tempBuffer - for building up the key and label.
      countersManager - which will allocate the counter.
      registrationId - of the action the counter is associated with.
      channelStatusId - with which the new counter is associated.
      name - for the counter to put in the label.
      typeId - to categorise the counter.
      Returns:
      the allocated counter.
    • updateBindAddress

      public static void updateBindAddress(AtomicCounter counter, String bindAddressAndPort, UnsafeBuffer countersMetadataBuffer)
      Update the key metadata and label to contain the bound socket address once the transport is active.
      Parameters:
      counter - representing the local socket address of the transport.
      bindAddressAndPort - in string representation.
      countersMetadataBuffer - to be updated for the bound address.
    • findAddresses

      public static List<String> findAddresses(CountersReader countersReader, long channelStatus, int channelStatusId)
      Find the list of currently bound local sockets.
      Parameters:
      countersReader - for the connected driver.
      channelStatus - value for the channel which aggregates the transports.
      channelStatusId - identity of the counter for the channel which aggregates the transports.
      Returns:
      the list of active bound local socket addresses.
    • findAddress

      public static String findAddress(CountersReader countersReader, long channelStatus, int channelStatusId)
      Find the currently bound socket address for the channel. There is an expectation that only one exists when searching.
      Parameters:
      countersReader - for the connected driver.
      channelStatus - value for the channel which aggregates the transports.
      channelStatusId - identity of the counter for the channel which aggregates the transports.
      Returns:
      the endpoint representing the bound socket address or null if not found.
    • findNumberOfAddressesByRegistrationId

      public static int findNumberOfAddressesByRegistrationId(CountersReader countersReader, long registrationId)
      Return number of local addresses for the given subscription registration id.
      Parameters:
      countersReader - for the connected driver.
      registrationId - for the subscription.
      Returns:
      number of local socket addresses in use.
    • isActive

      public static boolean isActive(CountersReader countersReader, int channelStatusId)
      Is a socket currently active for a channel.
      Parameters:
      countersReader - for the connected driver.
      channelStatusId - identity of the counter for the channel.
      Returns:
      true if the counter is active otherwise false.