Class ContainerMemoryTracker
- java.lang.Object
-
- org.apache.storm.daemon.supervisor.ContainerMemoryTracker
-
public class ContainerMemoryTracker extends Object
-
-
Constructor Summary
Constructors Constructor Description ContainerMemoryTracker(StormMetricsRegistry metricsRegistry)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getAssignedWorkerCount(String topologyId)
Gets the number of worker ports assigned to the given topology id on this supervisor.long
getReservedMemoryMb(String topologyId)
Gets the memory reserved by the given topology across all ports on this supervisor.Optional<Long>
getUsedMemoryMb(int port)
Get the memory used by the worker on the given port.long
getUsedMemoryMb(String topologyId)
Gets the memory used by the given topology across all ports on this supervisor.void
remove(int port)
Clears the topology assignment and tracked memory for the given port.void
setReservedMemoryMb(int port, String topologyId, long reservedMemoryMb)
Sets the reserved memory for the given port and topology id.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.
-
-
-
Constructor Detail
-
ContainerMemoryTracker
public ContainerMemoryTracker(StormMetricsRegistry metricsRegistry)
-
-
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 porttopologyId
- The topology idusedMemoryMb
- 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 porttopologyId
- The topology idreservedMemoryMb
- The memory reserved by the topology
-
-