Class ContainerMemoryTracker


  • public class ContainerMemoryTracker
    extends Object
    • Constructor Detail

    • Method Detail

      • getUsedMemoryMb

        public Optional<Long> getUsedMemoryMb​(int port)
        Get the memory used by the worker on the given port.
        Parameters:
        port - The worker port
        Returns:
        The memory used by the worker, or empty if no worker exists on the given port.
      • getUsedMemoryMb

        public long getUsedMemoryMb​(String topologyId)
        Gets the memory used by the given topology across all ports on this supervisor.
        Parameters:
        topologyId - The topology id
        Returns:
        The memory used by the given topology id
      • getReservedMemoryMb

        public long getReservedMemoryMb​(String topologyId)
        Gets the memory reserved by the given topology across all ports on this supervisor.
        Parameters:
        topologyId - The topology id
        Returns:
        The memory reserved by the given topology id
      • getAssignedWorkerCount

        public long getAssignedWorkerCount​(String topologyId)
        Gets the number of worker ports assigned to the given topology id on this supervisor.
        Parameters:
        topologyId - The topology id
        Returns:
        The number of worker ports assigned to the given topology.
      • remove

        public void remove​(int port)
        Clears the topology assignment and tracked memory for the given port.
        Parameters:
        port - The worker port
      • setUsedMemoryMb

        public void setUsedMemoryMb​(int port,
                                    String topologyId,
                                    long usedMemoryMb)
        Assigns the given topology id to the given port, and sets the used memory for that port and topology id.
        Parameters:
        port - The worker port
        topologyId - The topology id
        usedMemoryMb - The memory used by the topology
      • setReservedMemoryMb

        public void setReservedMemoryMb​(int port,
                                        String topologyId,
                                        long reservedMemoryMb)
        Sets the reserved memory for the given port and topology id.
        Parameters:
        port - The worker port
        topologyId - The topology id
        reservedMemoryMb - The memory reserved by the topology